OCaml 5.0.0
What's New
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, optimisations, etc., please consult the changelog.
Installation Instructions
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:
Configuration Options
The configuration of the installed opam switch can be tuned with the following options:
ocaml-option-afl
: set OCaml to be compiled withafl-fuzz
instrumentationocaml-option-bytecode-only
: compile OCaml without the native-code compilerocaml-option-flambda
: set OCaml to be compiled withflambda
activatedocaml-option-musl
: set OCaml to be compiled withmusl-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 withmusl-gcc -static
ocaml-option-address-sanitizer
: set OCaml to be compiled with address sanitiserocaml-option-leak-sanitizer
: set OCaml to be compiled with leak sanitiser
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 Distribution
- 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.
Alternative Compilers
Additionally, the following projects allow you to compile OCaml code to targets traditionally associated with other languages:
- Js_of_ocaml is a stable OCaml to JavaScript compiler.
User Manual
The user 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
Changes
This is the changelog. (Changes that can break existing programs are marked with a "breaking change" warning)