Implicit blocks for else.
Open
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 10.3k
- Forks
- 438
- PR merge metrics
- No merged PRs in 30d
Description
Many people want the benefits of early return. There's a way to get many of them without the complexity of early return:
We can simply allow the else blocks to not be wrapped in { }.
Instead of this:
let fn = (shouldRun, name) => {
if (!shouldRun()) {
[]
} else {
if (name == "test") {
[]
} else {
if (String.length(name) > 80) {
["name too long"]
} else {
[]
};
};
};
};
We could allow:
let fn = (shouldRun, name) => {
if (!shouldRun()) {
[]
} else
if (name == "test") {
[]
} else
if (String.length(name) > 80) {
["name too long"]
} else {
[]
}
};
Contributor guide
No contributing guide indexed for this repository
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
The issue names no files, tests, or entry points. Start by locating the Reason syntax and parser handling if/else expressions, then review existing grammar tests. Done means the unbraced else-if form is accepted while the existing braced form continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100