3 ms·
I've been a Haskell user for about a year now, and am pretty comfortable with the language. Ocaml has a lot of things that I like (the module system seems great
by thinkpad20 12y ago
I've been a Haskell user for about a year now, and am pretty comfortable with the language. Ocaml has a lot of things that I like (the module system seems great; strict evaluation is a win; mutability/loops/etc without having to jump through hoops). But every time I look at the actual code, I'm really turned off by a few things:
* lets everywhere, even at top-level. Haskell doesn't do this, which is a lot nicer.
* let rec. Wut?
* Apparently to produce code to run at top-level main loop you just assign it to a let _ = ..., which looks really hacky.
* Double semicolons.
* Type variables annotated with 'a. In Haskell, lowercase type names are variables, uppercase are constants (or type classes, but those aren't mixed).
* Mix of semicolons and end.
Haskell seems syntactically more elegant, has type classes which are (at least on the surface) more straightforward than modules, though I don't know which is more useful at the end of the day. Haskell's do syntax is very nice.
That said, in many ways OCaml seems much more like "my kind of language". But there are a number of turnoffs.
- tomp 12y agoHint: double semicolons are not necessary in files (just in the REPL). Also, personally I dislike Haskell's lower/uppercase conventions, and find OCaml's syntax marginally better in this respect (although I think best would be pre-declared parameters, like in C/Java/Scala/Julia).