Why I love OCaml (2023)
Perceived strengths of OCaml
- Many commenters agree with the article’s core praise: fast compilation, good performance, strong static typing with powerful inference, pattern matching, algebraic data types, and a pragmatic stance on mutation.
- Multicore + effect handlers are seen as a big advance, giving a modern concurrency story and potentially putting OCaml “ahead” in PL design.
- The module/functor system, named arguments, structural OO, and REPL are singled out as unusually powerful/pleasant for large systems and code generation.
Pain points and “friction”
- Ecosystem size is the main complaint: far fewer high‑quality libraries than mainstream languages; even basic things like OAuth2 clients or file-copy helpers are missing from stdlib.
- Tooling is viewed as uneven: opam is powerful but “weird/buggy”; ocamlformat defaults frustrate some; debugger and gdb integration are cited as weak vs. other ecosystems.
- Windows support is widely criticized as historically bad, only recently improving.
- Documentation is often terse and type‑signature‑only; examples and beginner‑oriented material are lacking.
- Syntax divides people: some like the minimalist ML style; others find it dense, hard to parse, and especially dislike the OOP syntax.
Ecosystem and industry use
- OCaml is acknowledged in compilers, theorem provers, FFTW’s generator, Tezos, Jane Street’s trading systems, Facebook’s typecheckers and tools, etc., but that’s still seen as niche.
- Some argue that needing in‑house forks (e.g., at large firms) shows the language is “almost there”; others say that’s normal for serious industrial users.
Comparisons to other languages
- Rust: often seen as having “stolen OCaml’s thunder” by bringing ADTs, pattern matching, strong typing into a more familiar systems language; but many stress Rust feels very different (no GC, traits instead of modules, borrow checker).
- F#: closer to OCaml but criticized for slower compiler, CLR entanglement, weaker type inference, and playing second fiddle to C#. Others praise its ecosystem and docs and prefer it on Windows.
- Haskell: more research‑y and pure; OCaml is seen as more pragmatic, easier to write in an imperative style when needed.
- Elixir/BEAM: viewed as “OCaml‑adjacent” in spirit (immutability, pattern matching, actors) with a much better story for web backends, but different trade‑offs (dynamic, VM, NIF pitfalls).
- TypeScript: some claim it gives “similar” type safety with far better tooling; others push back, pointing out TypeScript’s deliberate unsoundness and heavy use of
any.
Why isn’t OCaml more popular?
- Competing explanations:
- Ecosystem/tooling and Windows support lag far behind more popular languages.
- Syntax and “functional” branding scare off mainstream, C/Java‑raised developers.
- Popularity is driven more by platforms, killer apps, and marketing (Java, Python, JavaScript) than by language merit; OCaml never had a browser, big-company push, or AI moment.
- Fragmentation across the ML family (SML, OCaml, F#, Reason, etc.) dilutes mindshare.
- Some insist “frictions are overstated” and that momentum and familiarity (e.g., Go’s intentional simplicity) matter more than technical drawbacks.