What I dislike about OCaml

I came across the discussion and I wanted to share my newcomer perspective. I’ve started learning OCaml only a couple of months ago, but I do have experience with various FP languages (e.g. Clojure, Erlang, Elixir, Haskell, Scala).

Yeah, the rant was poorly written and rants generally serve little purpose, other than venting out. While you can’t please everyone I do think that some of the points about the experience of beginners make sense. I’ve started to play with OCaml recently after seeing some people I know from the Clojure community endorse/praise it here and there (e.g. @cemerick, who has always been one of Clojure heroes). My initial impression of the language is quite positive, but like many others I was somewhat put off by RWO leaning heavily on the Jane Street libs. I understand that some of the authors work at Jane Street, so I totally get their perspective, though - after all that’s how they do OCaml in the real world.

I also went over much of the Cornell course, which is good, but it’s clearly geared towards students (who does formal verification on the job? ). There’s clearly space for more entry-level books/resources on OCaml. If that wasn’t the case we probably wouldn’t be spending some much discussing the choices made by one particular book.

Syntactic preferences aside (like everyone I can bikeshed all day every day on trivialities), my only real gripe with OCaml so far is the small scope of the standard library - e.g. dealing with unicode strings and regular expressions in our day and age should be easy right? These days the expectation of most people is that a language comes with batteries included and plenty of great languages have “failed” because of this (e.g. Common Lisp, Scheme, etc). People are lazy and don’t want to reinvent the wheel all the time.

The OCaml tooling is an area where many people complain about, but I found it okay overall. Yeah, dune and opam don’t have the best docs, but they are relatively similar to what you’d find in other langs. Merlin/OCamlLSP provide adequate support for most editors. I even quickly hacked a few small patches for utop.el, flycheck-ocaml and tuareg-mode, as Emacs is my programming fortress.

Still, I was quite confused for a while what the hell is esy, jbuilder, etc. The relationship between OCaml and ReasonML definitely adds some complexity to the ecosystem. The more you read and practice the more you know and the pieces of the puzzles slowly get into place. Most people probably are not willing to go that far.

Third-party libs were also a mixed bag for me as I’d often notice libraries with little document or concerning little dev activity (e.g. the popular Dream framework).
I’ve been in plenty of small/fringe dev communities to not be super bothered by this, but I guess that’d be much more concerning to people who have spent their time mostly in the “mainstream”. Half my friends were telling me that learning OCaml in 2022 is a complete waste of time, as I already know to a different extent half a dozen FP languages and Haskell in particular is quite similar. Still, I don’t regret the time I invested in OCaml so far and hope to get even further with it. There’s a certain air of simplicity and pragmatism around it that I really like that reminds me from time to time of my beloved Clojure. I don’t like dogmatic languages, I like languages that help me solve a wide spectrum of problems

21 Likes