The history of OCaml releases with a summary and a complete changelog, as well as the manual at that time.

32 Releases
  • Reintroduced GC compaction
  • Restored native backend for POWER 64 bits
  • Thread sanitiser support
  • New Dynarray module
  • New -H flag for hidden include directories
  • Project-wide occurence metadata support for developer tools
  • Raw identifiers
  • Local open in type expressions
  • Around 20 new functions in the standard library
  • Many fixes and improvements in the runtime
  • Many bug fixes
  • Marshall.Compression flag removed from the standard library
  • Bug fixes for 5.1.0
  • Many runtime performance regression and memory-leaks fixes (dynlinking, weak array, weak hash sets, GC with idle domains, GC prefetching)
  • Restored support for native code generation on RISC-V and s390x architectures
  • Restored Cygwin port
  • Reduced installation size (50% reduction)
  • Compressed compilation artefacts (.cmi, .cmt, .cmti, .cmo, .cma files)
  • 19 error message improvements
  • 14 standard library functions made tail-recursive with Tail-Recursion-Modulo-Cons (TRMC), such as List.append and
  • 57 new standard library functions
  • More examples in the standard library documentation
  • 42 bug fixes

OCaml 5.0.0 introduces a completely new runtime system with support for shared memory parallelism and effect handlers.


Some of the highlights in OCaml 4.14.0 are:

  • Integrated support for "go to definitions" in Merlin.
  • Standard library: new modules In_channel and Out_channel, many new functions in Seq module, UTF decoding and validation support for strings and bytes.
  • Runtime optimisation: GC prefetching. Benchmarks show a speedup of around 20% in GC-heavy programs.
  • Improved error messages in particular for module-level error.
  • Deprecated functions and modules in preparation for OCaml 5. In particular, the Stream and Genlex modules are now deprecated.
  • Type variables can be explicitly introduced in value and variant constructor declarations. For instance,
        val fold: ('acc -> 'elt -> 'acc) -> 'acc -> 'elt list -> 'acc
        type showable = Show: 'a * ('a -> string) -> showable
    can now be written as
        val fold: 'acc 'elt. ('acc -> 'elt -> 'acc) -> 'acc -> 'elt list -> 'acc
        type showable = Show: 'a. 'a * ('a -> string) -> showable
  • Tail-call with up to 64 arguments are now guaranteed to be optimized for all architectures.
  • Experimental tail modulo cons (TMC) transformation
  • Safe points: a multicore prerequisite that ensures that ocamlopt-generated code can always be interrupted.
  • The best-fit GC allocation policy is the now default policy (and many other GCs improvements.
  • Named existential type variables in pattern matching Showable (type a) (x, show : a * (a -> string)).
  • Improved error messages for functor application and functor types.
  • Let-punning for monadic let: let* x = x in can be shortened to let* x in.
  • Module type substitutions SIG with module type T = F(X).S.
  • Many other quality of life improvements
  • Many bug fixes
  • Major progress in reducing the difference between the mainline and multicore runtime
  • A new configuration option ocaml-option-nnpchecker which emits an alarm when the garbage collector finds out-of-heap pointers that could cause a crash in the multicore runtime
  • Support for macOS/arm64
  • Mnemonic names for warnings
  • Many quality of life improvements
  • Many bug fixes
  • Statmemprof: a new statistical memory profiler
  • A new instrumented runtime that logs runtime statistics in a standard format
  • A native backend for the RISC-V architecture
  • Improved backtraces that refer to function names
  • Suppport for recursive and yet unboxed types
  • A quoted extension syntax for ppxs.
  • Many quality of life improvements
  • Many bug fixes.
  • A new best-fit allocator for the major heap which reducing both GC cost an memory usage.
  • Immutable strings are now enforced at configuration time
  • User-defined indexing operators for multidimensional arrays
  • Coming soon: statmemprof, a new statistical memory profiler. The external API will be release next version.
  • Miscellaneous improvements to the manual
  • A more precise exhaustiveness check for GADTs
  • Many bug fixes
  • New optimisations, in particular for affine functions in matches, for instance
      type t = A | B | C
      let affine = function
        | A -> 4
        | B -> 3
        | C -> 2
  • The graphics library was moved out of the compiler distribution.
  • The vmthread library was removed.
  • Support for compiler plugins was removed.
  • Many bug fixes.
  • Binding operators (let*, let+, and*, etc). They can be used to streamline monadic code.
  • open now applies to arbitrary module expression in structures and to applicative paths in signatures.
  • A new notion of (user-defined) "alerts" generalizes the deprecated warning.
  • New modules in the standard library: Fun, Bool, Int, Option, Result.
  • A significant number of new functions in Float, including FMA support, and a new Float.Array submodule.
  • Source highlighting for errors and warnings in batch mode.
  • Many error messages were improved.
  • Improved AFL instrumentation for objects and lazy values.
  • The standard library is now packed into a module called Stdlib, which is open by default. This makes it easier to add new modules to the standard library without clashing with user-defined modules.
  • The Bigarray module is now part of the standard library.
  • The modules Seq, Float were added to the standard library.
  • Improvements to several error and warning messages printed by the compiler make them much easier to understand.
  • Many improvements to flambda.
  • Removed the dependency on curses/terminfo/termcap.
  • The SpaceTime profiler now works under Windows.
  • Strings (type string) are now immutable by default. In-place modification must use the type bytes of byte sequences, which is distinct from string. This corresponds to the -safe-string compile-time option, which was introduced in OCaml 4.02 in 2014, and which is now the default.

  • Object types can now extend a previously-defined object type, as in <t; a: int>.

  • Destructive substitution over module signatures can now express more substitutions, such as S with type M.t := type-expr and S with module M.N := path.

  • Users can now define operators that look like array indexing, e.g. let ( .%() ) = List.nth in [0; 1; 2].%(1)

  • New escape \u{XXXX} in string literals, denoting the UTF-8 encoding of the Unicode code point XXXX.

  • Full Unicode support was added to the Windows runtime system. In particular, file names can now contain Unicode characters.

  • An alternate register allocator based on linear scan can be selected with ocamlopt -linscan. It reduces compilation time compared with the default register allocator.

  • The Num library for arbitrary-precision integer and rational arithmetic is no longer part of the core distribution and can be found as a separate OPAM package.

  • Some improvements in performance and usability.
  • Many bug fixes
  • Exceptions can be declared locally within an expression, with syntax let exception ... in ...

  • Optimized memory representation for immutable records with a single field, and concrete types with a single constructor with a single argument. This is triggered with a @@unboxed attribute on the type definition.

  • Support for the Spacetime memory profiler was added.

  • A new intermediate representation, called Flambda, was added to the native-code compiler, along with several new optimizations over the Flambda representation, such as aggressive function inlining. (The Flambda optimizer needs to be activated at configuration time by ./configure -flambda.)

  • New language feature: inline records as arguments to datatype constructors. This makes it possible to name the arguments of a constructor, and use convenient record notation to access them, without the cost of declaring a separate record type for the arguments.

  • The @unboxed and @untagged attributes are supported on external function declarations to pass parameters and results to C stub functions in a more efficient way. Other attributes honored by the compiler include @tailcall and @inline.

  • Improvements to the garbage collector, resulting in better GC latency (shorter GC pauses).

  • Support for ephemerons, a more general form of GC finalization of data structures.

  • The runtime system is now compiled at higher levels of C optimization, resulting in significant speedups for the bytecode interpreter.

  • New native code generators supporting the PowerPC 64-bit architecture (in big and little-endian modes) and the IBM zSystem architecture.

  • The whole code base (compilers, libraries and tools) is now licensed under the LGPL v2.1 with static linking exception.

  • The ocamlbuild compilation manager was split off and lives as an independent project.

  • In a first step towards making strings immutable, a type bytes of mutable byte arrays and a supporting library module Bytes were introduced. By default, bytes is a synonym for string, so existing code that mutates values of type string still compiles, with warnings. Option -safe-string separates the types string and bytes, making strings immutable.

  • The match construct was extended to discriminate not just on the value of its argument expression, but also on exceptions arising out of the evaluation of this expression. This solves an old problem: in a let x = a in b, catch exceptions raised by a but not those raised by b.

  • Module aliases (giving an alternative name to an existing module or compilation unit, as in module M = AnotherModule) are now tracked specially by the type system and the compiler. This enables not only more precise typing of applicative functors, but also more precise dependency analysis at link-time, potentially reducing the size of executables.

  • Annotations can now be attached to most syntactic elements of OCaml sources (expressions, definitions, type declarations, etc). These annotations are used by the compiler (e.g. to warn on uses of functions annotated as deprecated) but also by "ppx" preprocessors, to guide rewriting of abstract syntax trees.

  • Extensible data types can be declared (type t = ..) then later extended with new constructors (type t += A of int). This generalizes the handling of the exn type of exception values.

  • Functors and functor applications can now take a special () argument to force generativity of abstract types.

  • New toplevel directives #show_type, #show_modules, etc, to query the toplevel environment.

  • Performance of ocamlopt-generated code is improved on some programs through more aggressive constant propagation, two new optimization passes (dead code elimination and common subexpression elimination), better compilation of pattern-matching over strings, optimized representation of constant exceptions, and GC tuning for large memory heaps.

  • The format strings argument of printf functions are now represented as a GADT. This speeds up the printf functions considerably, and leads to more precise typechecking of format strings.

  • The native-code compiler now supports the AArch64 (ARM 64 bits) architecture.

  • The Camlp4 preprocessor and the Labltk library were split off the distribution. They are now separate projects.

  • It is now possible to have several variant constructors or record fields of the same name in scope, and type information will be used to disambiguate which one is used -- instead of always using the last one. See this post for a more detailed description of the feature.

  • New warnings can be activated to warn about identifiers that are used after having been shadowed by an open construct. The open keyword can be written open! to silence this warning (as method! silences the method warning).

  • The compiler now suggests possible typos on "unbound identifier" errors.

  • Infix application operators (|>) and (@@) are added to Pervasives.

  • The -short-path option changes the way the type-checker prints types to pick a short representation (eg. string instead of StringSet.elt).

  • This release saw a lot of polishing with sets of changes in many places: the type system for GADTs, compilation speed with -bin-annot, ocamlbuild, the test suite, low-level optimizations, etc.

  • The name the language is now officially "OCaml", and this name is used consistently in all the documentation and tool outputs.

  • Generalized Algebraic Data Types (GADTs): this is a powerful extension of the type system that provides great flexibility and power to the programmer.

  • A new and improved ARM back-end.

  • Changes to first-class modules: type annotations can now be omitted when packing and unpacking modules (and are inferred from context whenever possible), and first-class modules can now be unpacked by pattern-matching.

  • Support for randomized hash tables to avoid denial-of-service vulnerabilities.

  • Installation of the compiler's internal libraries in +compiler-libs for easier access by third-party programming tools.

  • Polymorphic recursion is supported, using explicit type declarations on the recursively-defined identifiers.

  • First-class modules: module expressions can be embedded as values of the core language, then manipulated like any other first-class value, then projected back to the module level.

  • New operator to modify a signature a posteriori: S with type t := tau denotes signature S where the t type component is removed and substituted by the type tau elsewhere.

  • New notations for record expressions and record patterns: { lbl } as shorthand for { lbl = lbl }, and { ...; _ } marks record patterns where some labels were intentionally omitted.

  • Local open let open ... in ... now supported by popular demand.

  • Type variables can be bound as type parameters to functions; such types are treated like abstract types within the function body, and like type variables (possibly generalized) outside.

  • The module type of construct enables to recover the module type of a given module.

  • Explicit method override using the method! keyword, with associated warnings and errors.