I like a lot of what you've done with Reason, but I'm not fond of braces everywhere.
How about allowing certain braces to become do...end (I chose do, as in ruby, mostly because it's shorter than begin).
Examples:
let f => do
...
end
let x = switch do
| ...
end
For if/then/else, it could be simplified slightly:
if x == 3 do
...
else
...
end
I think this would make the language much more palatable to functional language types such as myself.
That's what ocaml had, and it caused a ton of confusion around when to use begin block, when to use struct, and braces, etc. If we switch to do we'd have to switch it everywhere or otherwise we'd be shuffling around the old syntaxes and repeating the same mistake. I think this has been debated before and the decision is that if we wanted a uniform way of writing blocks, we'd go with braces, despite the compromise you mentioned.
Reason's still in its early days; ultimately individuals will be able to swap around their preferred syntax. Since this particular change isn't in the roadmap I'll close this issue. But we'll definitely keep this in mind, thanks.
This isn't really what OCaml has.
If you convert every brace optionally to do...end and require it in for loops, function definitions, scopes etc, you get just as uniform a syntax, but one that isn't nearly as littered with braces.
Ah I see, sorry about that. @jordwalke has more opinion on it.
Most helpful comment
This isn't really what OCaml has.
If you convert every brace optionally to do...end and require it in for loops, function definitions, scopes etc, you get just as uniform a syntax, but one that isn't nearly as littered with braces.