OCaml 5.4.0 (9 October 2025)
----------------------------

Some of the highlights of OCaml 5.4.0 are:

- Labelled tuples
- Immutable arrays
- Array literal syntax support for immutable arrays and `floatarray`s
  (through type-directed disambiguation)
- Atomic record fields
- Four new standard library modules: Pair, Pqueue, Repr, and Iarray
- Restored "memory cleanup upon exit" mode
- New chapter in the manual on profiling OCaml programs on Linux and macOS

And a lot of incremental changes:

- Many runtime and code generation improvements
- More than thirty new standard library functions
- Nearly a dozen improved error messages
- Around fifty bug fixes

OCaml 5.3.0 (8 January 2025)
----------------------------

Some of the highlights of OCaml 5.3.0 are:

- Syntax for deep effect handlers
- Restored MSVC port
- Re-introduced statistical memory profiling (statmemprof)
- utf-8 encoded Unicode source files and modest support of Unicode identifiers
- More space-efficient implementation of Dynarray
- Improved metadata on the pairs of declarations and definitions for merlin.

And a lot of incremental changes:

- Around 20 new functions in the standard library
- Many fixes and improvements in the runtime
- Improved error messages for first-class modules, functors, labeled arguments,
type clashes.
- Numerous bug fixes

OCaml 5.2.0 (13 May 2024)
------------------------

OCaml 5.2.0 is still a somewhat experimental release compared to the OCaml 4.14
branch. Some of the highlights in OCaml 5.2.0 are:

- Re-introduced GC compaction
- Restored native backend for POWER 64 bits
- Thread sanitizer support
- New Dynarray module
- New -H flag for hidden include directories
- Project-wide occurrence metadata support for developer tools
- Raw identifiers
- Local open in type expressions

And a lot of incremental changes:

- Around 20 new functions in the standard library
- Many fixes and improvements in the runtime
- Many bug fixes

OCaml 5.1.0 (14 September 2023)
-------------------------------

OCaml 5.1.0 is still a relatively experimental release compared to the OCaml
4.14 branch. Some of the highlights in OCaml 5.1.0 are:

-  Many runtime performance regression and memory-leaks fixes
    (dynlinking, weak arrays, weak hash sets, GC with idle domains,
     and 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 List.map.
- 57 new standard library functions
- More examples in the standard library documentation
- 42 bug fixes


OCaml 5.0.0 (15 December 2022)
------------------------------

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

As a language, OCaml 5 is fully compatible with OCaml 4 down to the performance
characteristics of your programs. In other words, any code that works with OCaml
4 should work the same with OCaml 5.

The currently known exceptions to this rule are:

- the removal of many long-deprecated functions and modules
- changes to the internal runtime API
- the performance of ephemerons is currently (and temporarily) strongly
  degraded.


OCaml 4.14.0 (28 March 2022)
----------------------------

- 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,
```ocaml
    val fold: ('acc -> 'elt -> 'acc) -> 'acc -> 'elt list -> 'acc
    type showable = Show: 'a * ('a -> string) -> showable
```
can now be written as
```ocaml
    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

OCaml 4.13.0 (24 September 2021)
-------------------------------

- Safe points: a multicore prerequisite that ensures that ocamlopt-generated
  code can always be interrupted.
- The best-fit GC allocation policy is 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

OCaml 4.12.0 (24 February 2021)
-------------------------------

- 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


OCaml 4.11.0  (19 August 2020)
------------------------------

- 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
- Support for recursive and yet unboxed types
- A quoted extension syntax for ppxs.
- Many quality of life improvements
- Many bug fixes.


OCaml 4.10.0 (21 February 2020)
-------------------------------

- New best-fit allocator for the major heap
- Preliminary runtime work for OCaml multicore
- 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 released next version.
- Various improvements to the manual
- More precise exhaustiveness check for GADTs
- Many bug fixes


OCaml 4.09.1 (18 March 2020)
----------------------------

Bug fixes.

OCaml 4.09.0 (18 September 2019)
--------------------------------

- 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.

OCaml 4.08.1 (5 August 2019)
----------------------------

Bug fixes.

OCaml 4.08.0 (14 June 2019)
---------------------------

- 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.


OCaml 4.07.1 (4 October 2018)
-----------------------------

This release consists mostly of bug fixes. The most salient bugs were

- MPR#7820, GPR#1897: a bug in Array.of_seq (new in 4.07)
  (Thierry Martinez, review by Nicolás Ojeda Bär)

- MPR#7815, GPR#1896: crash in the major GC with the first-fit policy
  (Stephen Dolan and Damien Doligez, report by Joris Giovannangeli)

- MPR#7821, GPR#1908: the compiler loads more cmi, which breaks some builds
  (Jérémie Dimino, review by Gabriel Scherer)

- MPR#7833, GPR#1946: typechecking failure (regression) on large GADT matchings
  (Thomas Refis, report by Jerome Simeon, review by Jacques Garrigue)

See the detailed list of fixes at (Changes#4.07.1).


OCaml 4.07.0 (10 July 2018):
----------------------------

Some highlights of this release are:

-   The way the standard library modules are organized internally has
    changed (GPR#1010, by Jérémie Dimino):

    1. the `List` module (for example) is now named `Stdlib__list`
    2. a new Stdlib module contains a series of aliases
    such as `module List = Stdlib__list`
    3. the `Stdlib` module is implicitly opened when type-checking OCaml
    programs (as `Pervasives` previously was), so that `Stdlib.List` can be
    accessed as just `List`, as before.

    This should be invisible to most users, although it is possible that
    some tools show the `Stdlib.` or `Stdlib__` prefixes in
    messages. (You might want to report these situations as usability
    bugs.) The change prevents standard library modules from conflicting
    with end-user filenames (please avoid `stdlib.ml` and the
    `Stdlib__` prefix); we may introduce new standard library modules in
    the future with less fear of breaking user code. In particular,
    `Float` (GPR#1638, by Nicolás Ojeda Bär) and `Seq` (GPR#1002, by
    Simon Cruanes) modules have now been added to the standard library.

-   The error messages caused by various typing errors have been improved
    to be easier to understand, in particular for beginners.
    (GPR#1505, GPR#1510, by Arthur Charguéreau and Armaël Guéneau)

    For example,

        # while 1 do () done;;
                ^
        Error: This expression has type int but
               an expression was expected of type bool

    now adds the extra explanation

        because it is in the condition of a while-loop

-   Effort has been made to reduce the compilation time of flambda
    programs, and the size of the produced `.cmx` files when using
    the -Oclassic optimisation level.
    (GPR#1401, GPR#1455, GPR#1627, GPR#1665, by Pierre Chambart, Xavier
    Clerc, Fuyong Quah, and Leo White)

-   The HTML manual has benefited from various style improvements
    and should look visually nicer than previous editions.
    (GPR#1741, GPR#1757, GPR#1767 by Charles Chamberlain and steinuil)

    The new version of the manual can be consulted at
    <http://caml.inria.fr/pub/docs/manual-ocaml-4.07/>; see the
    previous version for comparison at
    <http://caml.inria.fr/pub/docs/manual-ocaml-4.06/>.

-   Since 4.01, it is possible to select a variant constructor or
    record field from a sub-module that is not opened in the current
    scope, if type information is available at the point of use. This
    now also works for GADT constructors.
    (GPR#1648, by Thomas Refis and Leo White)

-   The GC should handle the accumulation of custom blocks in the minor
    heap better; this solves some memory-usage issues observed by code
    which allocates a lot of small custom blocks, typically small bigarrays
    (GPR#1476, by Alain Frsich)

See also the detailed list of changes: (Changes#4.07.0).


OCaml 4.06.1 (16 Feb 2018):
---------------------------

This release consists mostly of bug fixes. The most salient bugs were

-   An incorrect compilation of pattern-matching in presence of
    extensible variant constructors (such as exceptions), that had been
    present for a long time.
    (GPR#1459, GPR#1538, by Luc Maranget, Thomas Refis and Gabriel Scherer)

-   An optimization of `not (x = y)` into `x <> y`, introduced in
    4.06.0, is incorrect on floating-point numbers in the `nan`
    case. (GPR#1470, by Leo White)

See the detailed list of fixes at (Changes#4.06.1).


OCaml 4.06.0 (3 Nov 2017):
--------------------------

-   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.
    (GPR#1252, by Damien Doligez)

-   Object types can now extend a previously-defined object type,
    as in `<t; a: int>`.
    (GPR#1118, by Runhang Li)

-   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`.
    (GPR#792, by Valentin Gatien-Baron)

-   Users can now define operators that look like array indexing,
    e.g. `let ( .%() ) = List.nth in [0; 1; 2].%(1)`
    (GPR#1064, GPR#1392, by Florian Angeletti)

-   New escape `\u{XXXX}` in string literals, denoting the UTF-8
    encoding of the Unicode code point `XXXX`.
    (GPR#1232, by Daniel Bünzli)

-   Full Unicode support was added to the Windows runtime system.  In
    particular, file names can now contain Unicode characters.
    (GPR#153, GPR#1200, GPR#1357, GPR#1362, GPR#1363, GPR#1369, GPR#1398,
    GPR#1446, GPR#1448, by ygrek and Nicolás Ojeda Bär)

-   An alternate register allocator based on linear scan can be selected
    with `ocamlopt -linscan`.  It reduces compilation time compared with
    the default register allocator.
    (GPR#375, Marcell Fischbach and Benedikt Meurer)

-   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.

See the detailed list of changes: (Changes#4.06.0).


OCaml 4.05.0 (13 Jul 2017):
---------------------------

Some highlights include:

-   Instrumentation support for fuzzing with afl-fuzz.
    (GPR#504, by Stephen Dolan)

-   The compilers now accept new `-args/-args0 <file>` command-line
    parameters to provide extra command-line arguments in a file.  User
    programs may implement similar options using the new `Expand`
    constructor of the `Arg` module.
    (GPR#748, GPR#843, GPR#864, by Bernhard Schommer)

-   Many functions of the standard library that raise an exception now
    have an option-returning variable suffixed by `_opt` Typical
    examples of the new functions include:

        int_of_string_opt: string -> int option
        List.nth_opt: 'a list -> int -> 'a option
        Hashtbl.find_opt : ('a, 'b) t -> 'a -> 'b option

    (GPR#885, by Alain Frisch)

-   The security of the runtime system is now hardened by using `secure_getenv`
    to access environment variables whenever its possible, to avoid unplanned
    privilege-escalation when running setuid binaries.
    (GPR#1213, by Damien Doligez)

See the detailed list of changes: (Changes#4.05.0).
