Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: case statements #8229

Closed

Conversation

Alizter
Copy link
Collaborator

@Alizter Alizter commented Jul 18, 2023

We add a (case ...) constructor to dune_lang for actions which when expanded will reduce down to the matching branch. Basic use looks like:

 (rule
  (alias foo)
  (action
   (case %{read-lines:version}
    (1 (echo "version is 1"))
    (2 (echo "version is 2"))
    (3 (echo "version is 3"))
    (_ (echo "shouldn't happen, got %{read-lines:version}")))))

which together with a version file containing 2 would print 2.

@Alizter Alizter force-pushed the ps/branch/feature__case_statements branch from 2e62977 to 1665240 Compare July 18, 2023 23:08
We add a `(case ...)` constructor to dune_lang for actions which when
expanded will reduce down to the matching branch.

Signed-off-by: Ali Caglayan <alizter@gmail.com>
@Alizter Alizter force-pushed the ps/branch/feature__case_statements branch from 1665240 to 3fd87ee Compare July 18, 2023 23:17
@Alizter
Copy link
Collaborator Author

Alizter commented Jul 24, 2023

I'm gonna open another PR at a later date with cond.

@Alizter Alizter closed this Jul 24, 2023
@Alizter Alizter deleted the ps/branch/feature__case_statements branch July 24, 2023 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant