6 ms·
I don't know why they felt they had to mess with OCaml's syntax - one of the nicest around AFAIC. With F#, even MS didn't feel like they had to add extra brace
by thelazydogsback 7y ago
I don't know why they felt they had to mess with OCaml's syntax - one of the nicest around AFAIC. With F#, even MS didn't feel like they had to add extra braces and other baggage and change keywords ("match" to "switch ()", etc.) to make C# programmers have an easier first ten minutes of transition time.
- emmanueloga_ 7y agoAre you referring to Reason? I don't see anything related to messing OCaml syntax in the OP.
- thelazydogsback 7y ago"Reason, also known as ReasonML, is a syntax extension and toolchain for OCaml created by Jordan Walke at Facebook.[2] Reason offers a syntax familiar to JavaScript programmers, and transpiles to OCaml.[3]" https://en.wikipedia.org/wiki/Reason_(syntax_extension_for_OCaml) https://en.wikipedia.org/wiki/Reason_(syntax_extension_for_O...
- emmanueloga_ 7y agogot it, I was just confused since usually top level comments refer to the original post, which in this case is a Textbook for OCaml that doesn't mention Reason anywhere afaict
- thelazydogsback 7y agoSorry, my bad - I meant to reply to @melling, not the top-level
- nv-vn 7y agoThere's a few legitimate issues with OCaml syntax that have been fixed by Reason at least. E.g. `match`/`if` not having an `end` means you need to use parens or `begin`/`end` to nest match and have ; inside of an `if` body. There's also some ambiguity between functional `if` and imperative `if` in some situations.
- toastal 7y agoDespite that, Reason adds semicolons and braces to OCaml; presumably this was to make it have a more JavaScript aesthetic for on-boarding (ignoring JS's ASI)?
- nine_k 7y agoExplicit opening and closing structures help locate and explain errors better. In an absence of an entirely obvious, unambiguous, commonly known way of formatting, it's helpful.
- pjmlp 7y agoBecause OCaml aware editors/IDE don't exist.
- pyrale 7y agoI'm not sure to understand how it helps. Are you talking about parsing errors ? As for formatting, if you manage to get an AST, what would be made easier by braces ?
- nine_k 7y agoYes, parsing errors. In a number of cases you can legitimately continue to interpret a text well past the missing closing token, and signal an error in a place which does not seem related. If you already have a correct AST, you can render it whatever way you want.
- jolux 7y agoI think F# cleaned up a lot of OCaml’s syntactic oddities nicely, though I could do without the off-side rule.
- yawaramin 7y agoWell, with F# they did change some significant things e.g. type parameter syntax. Anyway, the point of Reason is that some people just won't even look at OCaml syntax. They just won't, that's the way it is. Reason allows us to onboard those people now, get them to see the benefits of the language, and perhaps later even come around to preferring the OCaml syntax.
- smabie 7y agoI think Haskell's or F#'s syntax is a lot better, OCaml has a lot of edge cases that require parens. OCaml is an old language and it really shows in the syntax. I personally think Reason's cleanup of strange parsing rules that OCaml has is a good step forward, though changing match to switch is kind of annoying, I must admit.