OCaml 1996
Functional ML with industrial teeth — type inference that catches your mistakes before they exist.
Influenced by: Rust
OCaml is a pragmatic, industrial-strength descendant of the ML family from France's Inria: it pairs whole-program Hindley–Milner type inference with algebraic data types, exhaustive pattern matching, and a uniquely expressive module-and-functor layer. You get the safety and concision of a functional language without giving up speed, mutation, or objects when you need them — code reads like math but compiles to fast native binaries. It is the language behind Jane Street's trading systems, the Rocq/Coq proof assistant, MirageOS unikernels, and the first Rust compiler.
What makes it distinctive
- Hindley–Milner type inference infers the most general type of nearly every expression with no annotations — you write code that looks dynamically typed but is fully statically checked.
- A module system with functors: modules are parameterised by other modules, so you write code generic over entire structures (a
Set.Make(IntOrder)instead of ad-hoc generics), all resolved at compile time. - Algebraic data types plus exhaustive pattern matching — the compiler warns when a
matchmisses a case, turning whole classes of bugs into compile errors. - Genuinely multi-paradigm: a functional core with first-class imperative features (refs, mutable records, arrays, exceptions) and a sound, type-inferred object system layered on top.
- Compiles to fast native code with a low-latency garbage collector, while also offering a bytecode compiler and a REPL (
utop) for interactive development. - GADTs and first-class modules (since 4.0) let you encode rich invariants in types and pass modules around as ordinary values.
- Effect handlers (since 5.0) provide typed, resumable control flow — the substrate for concurrency libraries without callback or monad clutter.
- Shared-memory parallelism arrived in OCaml 5.0 via domains after a decade-long Multicore runtime rewrite, with backward compatibility preserved.
- Quietly powers heavyweight software: the Rocq/Coq proof assistant, MirageOS unikernels, the original Rust compiler, Astrée (Airbus flight-control verification), and Jane Street's entire trading stack.
History
OCaml is the latest member of the Caml lineage, a family of ML dialects developed at Inria (France's national institute for research in computer science). The original Caml appeared in 1987, designed by Gérard Huet, Guy Cousineau, Ascánder Suárez, Pierre Weis and others; the name nods to the Categorical Abstract Machine it first targeted, though the team happily leaned into the camel mascot anyway. ML itself — the language Caml descends from — had been invented by Robin Milner in the 1970s as the meta-language for the LCF theorem prover, and brought with it the type-inference algorithm now known as Hindley–Milner.
In 1990 Damien Doligez and Xavier Leroy built Caml Light, a small, portable reimplementation running on a bytecode interpreter with a fast generational garbage collector. It was compact enough to fit on the machines of the era and became widely used for teaching. Leroy followed it in 1995 with Caml Special Light, which added a native-code compiler and, crucially, a complete module system with functors inspired by Standard ML — parameterised modules that let you write code generic over whole structures, all checked at compile time.
Objective Caml arrived in 1996 when Didier Rémy and Jérôme Vouillon grafted a sound, type-inferred object-oriented layer onto Caml Special Light — a genuinely novel piece of type theory, since objects and Hindley–Milner inference are hard to reconcile. This is the release that, fifteen years later in 2011, was simply renamed OCaml. The combination of functional core, imperative escape hatches, modules, and objects in one statically typed language gave OCaml its enduring multi-paradigm character.
Throughout the 2000s OCaml earned a reputation as the connoisseur's compiled language: small, fast, and ruthlessly type-safe. It powered Inria's Coq proof assistant (renamed Rocq in 2025) and the Astrée static analyzer used to verify Airbus flight-control software. Famously, Graydon Hoare's first compiler for Rust was written in OCaml before Rust became self-hosting — one of several languages, alongside F#, Scala, Elm and ReasonML, that carry OCaml's fingerprints.
OCaml 4.0 (2012) was a watershed release, adding GADTs (generalized algebraic data types) and first-class modules, letting modules be passed around as ordinary values. The 4.x series ran for a decade and became the bedrock of the language's industrial adoption, most visibly at Jane Street, the trading firm that writes essentially its entire stack in OCaml, open-sourced the Core standard library and the Dune build system, and bankrolled much of the modern toolchain.
The long-running grand challenge was parallelism: OCaml's classic runtime had a single global heap and no shared-memory threads. After roughly a decade of research, OCaml 5.0 (December 2022) delivered a complete runtime rewrite — the Multicore project — bringing genuine shared-memory parallelism via domains and, alongside it, effect handlers: a structured, typed form of resumable control flow that powers lightweight concurrency without monad gymnastics. It was a rare feat: adding parallelism and algebraic effects to a 25-year-old language while keeping existing single-threaded code working.
Development continues at a steady clip. The 5.x series has added refinements such as deep effect-handler syntax (5.3) and, in 5.4 (October 2025), labelled tuples, immutable arrays, and atomic record fields. The current stable release is 5.4.1 (February 2026). Tooling has matured in parallel — opam for packages, Dune for builds, Merlin and the OCaml LSP for editor intelligence, and js_of_ocaml / Melange for compiling to JavaScript — turning what was once a niche academic language into a quietly thriving production ecosystem.