OCaml 5.0.0 introduces a completely new runtime system 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.
For a comprehensive list of changes and details on all new features, bug fixes, optimizations, etc., please consult the changelog.
The base compiler can be installed as an opam switch with the following commands:
opam update opam switch create 5.0.0
It might be also interesting to check the new support for parallelism by installing the
domainslib library with
opam install domainslib
The source code for the release candidate is also directly available on:
The configuration of the installed opam switch can be tuned with the following options:
- ocaml-option-afl: set OCaml to be compiled with afl-fuzz instrumentation
- ocaml-option-bytecode-only: compile OCaml without the native-code compiler
- ocaml-option-flambda: set OCaml to be compiled with flambda activated
- ocaml-option-musl: set OCaml to be compiled with musl-gcc
- ocaml-option-no-flat-float-array: set OCaml to be compiled with --disable-flat-float-array
- ocaml-option-static :set OCaml to be compiled with musl-gcc -static
- ocaml-option-address-sanitizer: set OCaml to be compiled with address sanitizer
- ocaml-option-leak-sanitizer: set OCaml to be compiled with leak sanitizer
For instance, one can install a switch with both
flambda and the naked-pointer checker enabled with
opam switch create 5.0.0+flambda+nnpchecker --package=ocaml-variants.5.0.0+options,ocaml-option-flambda,ocaml-option-nnpchecker
or with opam 2.1:
opam switch create 5.0.0+flambda+nnpchecker ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-nnpchecker
- Source tarball (.tar.gz) for compilation under Unix (including Linux and MacOS X) and Microsoft Windows (including Cygwin).
- Also available in .zip format.
- OPAM is a source-based distribution of OCaml and many companion libraries and tools. Compilation and installation are automated by powerful package managers.
- The official development repo is hosted on GitHub.
The INSTALL file of the distribution provides detailed compilation and installation instructions — see also the Windows release notes for instructions on how to build under Windows.
Additionally, the following projects allow you to compile OCaml code to targets traditionally associated with other languages:
The user's manual for OCaml can be:
- browsed online,
- downloaded as a single PDF, or plain text document,
- downloaded as a single TAR or ZIP archive of HTML files,
- downloaded as a single tarball of Emacs info files,
This is the changelog. (Changes that can break existing programs are marked with a "breaking change" warning)