Hasty Briefsbeta

Bilingual

Pain Points of OCaml

6 months ago
  • #Compiler
  • #Rust
  • #OCaml
  • The author is seeking a job for new graduates in 2026, with skills in Rust, TypeScript, or React.
  • OCaml's syntax is criticized for being unclear, especially with nested match statements and lack of punctuation.
  • Automatic currying and partial function application in OCaml often lead to bugs and inscrutable error messages.
  • OCaml's type inference is powerful but can produce opaque errors, making debugging difficult.
  • Types in OCaml cannot be used before declaration, and enumerated types are not namespaced, leading to potential shadowing.
  • OCaml's tooling has improved, with Dune as a build system, but the ecosystem is dominated by Jane Street's Core library.
  • Compiler tools like ocamllex and Menhir have their own DSLs and emit unhelpful 'Syntax Error' messages.
  • Printing in OCaml is cumbersome, requiring custom print functions for objects, unlike Rust's #[derive(Debug)].
  • Rust is praised for robustness and maintainability, while OCaml is seen as elegant but less practical for long-term projects.
  • Despite its flaws, OCaml is considered for future compiler projects due to its functional approach and pattern matching.