Apparently folks find it confusing that it sometimes need parens and sometimes doesn't.
We can keep the non-parenthesized version in the parser to be lenient, but print the parens.
Same for try catch
An example of when this is confusing. If I start with this:
let fn = (v1, v2) => switch v1 {
| true => "ok"
| _ => "other"
}
and then modify by adding && v2, like this:
let fn = (v1, v2) => switch v1 && v2 {
| true => "ok"
| _ => "other"
}
I get "UNKNOWN SYNTAX ERROR".
btw for this case, you should use a tuple: https://reasonml.github.io/guide/language/tuple#tips--tricks
Yeah, either way, the example is just to show how an innocuous progression of code modifications can lead to a difficult to understand parse error.
I'd argue for less parentheses in general - it should be possible to not require parentheses in nearly any case, like Rust.
@ubsan that would be my preference as well... I recall some discussion about it earlier but can't find why this was harder to do
This can be closed thanks to #1720 / #1733, correct?
Yep, thanks
Most helpful comment
Yeah, either way, the example is just to show how an innocuous progression of code modifications can lead to a difficult to understand parse error.