4 ms·
Since when OCaml is semicolon-free? It not only has semicolons, single semicolon (;) means something different than double semicolon (;;). The former is used as
by klibertp 14y ago
Since when OCaml is semicolon-free? It not only has semicolons, single semicolon (;) means something different than double semicolon (;;). The former is used as an expression separator, like comma in Erlang, and the latter denotes the end of a top-level declaration, like period in Erlang. That's a pain while refactoring, but I can live with it. Anyway, that's just a style, nothing more, you can learn to love it or you can write a "transpiler", it's really a non-issue.
- lobster_johnson 14y agoTrue, Ocaml has semicolons, although it's a little different given that you can construct deeply nested functional expressions without ever using a single one. If I remember correctly the semicolon is a separator, not a terminator, which means that declarations don't need to end with a semicolon, for example, and you pretty much only need it to separate statements.
- kibwen 14y agoAFAICT, if you were to write in Lisp-like purely-functional style, you wouldn't need any semicolons in your Rust code either.
- klibertp 14y agoI'm not sure I prefer 'in' over semicolon in declarations. I mean: let x = ref 0 in (* something *) in Ocaml is not much worse/better than let mut x = 0; // something in Rust. As I said above, that's really a minor, stylistic issue, one probably would write "let x = mut 0 in" for a week or so (coming from OCaml) and that's it, after a week it becomes as natural to write semicolon as it is to write 'in'.
- lobster_johnson 14y agoI agree, I didn't really put OCaml forward as the ideal solution. Ruby and Go solve the semicolon problem in much better ways, in my opinion.