Adding some conditionals in the language
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 1.9k
- Forks
- 500
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 277
Description
This is similar to #819 but with a somewhat broader scope.
The idea would be to support (if <cond> <then> [else]) at the toplevel of a jbuild.
This would allow encoding the example of #819, which was:
(alias
((name runtest)
(deps (foo.exe))
(action (run ${<}))
(enabled_if (and (<> ${os} win32) (>= ${ocaml_version} 4.0.5)))))
as
(if (and (<> ${os} win32) (>= ${ocaml_version} 4.0.5))
(alias
((name runtest)
(deps (foo.exe))
(action (run ${<})))))
(of course I have nothing with the sugar proposed in #819).
But would also allow doing things like:
(if (= ${ocaml_version} "4.07._")
(copy_files# 407/*.ml{,i}))
(if (= ${ocaml_version} "4.06._")
(copy_files# 406/*.ml{,i}))
...
which are needed for merlin and currently require us to use ocaml jbuilds.
I'm only proposing to support this at the toplevel, but this could be pushed down to arbitrary places (after all, (select ...) already does similar things).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the referenced issue #819 and the existing top-level jbuild handling, then compare it with the mentioned (select ...) form. The work is complete when top-level (if <cond> <then> [else]) supports the shown alias and version-specific copy_files# examples, with behavior defined for the proposed scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100