OCaml 5.0.0, first beta release

The release of OCaml 5.0.0 is drawing near.

After two alpha releases, we have released a first beta version to help you update your softwares and libraries ahead of the release (see below for the installation instructions).
The standard library has been stabilized and many opam packages already work with this release.
If you find any bugs, please report them here:

Issues · ocaml/ocaml · GitHub

Compared to the last alpha release, this beta contains many small internal runtime fixes (in particular in the systhreads library).
At the user level, the interfaces of the Domain and Effect modules have been tweaked to be more forward-compatible:

  • Exceptions related to effects are now defined in the Effect module.
  • The value Domain.recommended_domain_count is no longer a constant and the function Domain.at_each_spawn has been removed.
    With those changes, the standard library should be stable now.
    The final release of OCaml 5.0.0 is currently expected to be in December.

If you are interested by the ongoing list of bug fixes, the updated change log for OCaml 5.0.0 is available at:

ocaml/Changes at 5.0 · ocaml/ocaml · GitHub

You can also follow the state of the opam ecosystem on

OCaml 5.0 Release Readiness · Issue #21526 · ocaml/opam-repository · GitHub

and

http://check.ocamllabs.io/

A short summary of the changes since the last alpha release is also available
below.


Installation instructions

The base compiler can be installed as an opam switch with the following commands
on opam 2.1:

opam update
opam switch create 5.0.0~beta1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.0.0~beta1 --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

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 beta release is available at these addresses:

https://github.com/ocaml/ocaml/archive/5.0.0-beta1.tar.gz
https://caml.inria.fr/pub/distrib/ocaml-5.0/ocaml-5.0.0~beta1.tar.gz

Fine-tuned compiler configuration

If you want to tweak the configuration of the compiler, you can switch to the option variant with:

opam update
opam switch create <switch_name> ocaml-variants.5.0.0~beta1+options <option_list>

where option_list is a comma separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.0.0~beta1+flambda+nffa ocaml-variants.5.0.0~beta1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam versions anterior to 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~beta1+options,<option_list> --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

In both cases, all available options can be listed with “opam search ocaml-option”.

Optional opam alpha repository

During the beta release, if your dependencies are not yet compatible with OCaml 5.0.0,
you might want to check the alpha opam repository:

Which can be installed with

opam repo add alpha git+https://github.com/kit-ty-kate/opam-alpha-repository.git

You can check that the alpha repository has been correctly installed with

$ opam repo
<><> Repository configuration for switch 5.0.0~beta1 <><><><><><><><><><><><><>
 1 alpha   git+https://github.com/kit-ty-kate/opam-alpha-repository.git
 2 default https://opam.ocaml.org

This alpha repository contains various fixes that are in the process of being upstreamed,
but it should be less and less required with the progress of the beta release.


Changes since the last alpha release

Stdlib changes

  • #11309, #11424, #11427, +#11545: Add Domain.recommended_domain_count.
    (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp,
    KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar)
  • #11423: Move the effect exceptions to the Effect module
    (KC Sivaramakrishnan, Xavier Leroy, and Florian Angeletti, review by
    Florian Angeletti, Xavier Leroy, and KC Sivaramakrishnan)

  • #11593: Remove Domain.at_each_spawn
    (Florian Angeletti, review by Guillaume Munch-Maccagnoni
    and KC Sivaramakrishnan)

Bug fixes

  • #11303: Ensure that GC is not invoked from bounds check failures
    (Stephen Dolan, review by Sadiq Jaffer and Xavier Leroy)

  • #5299, #4787, #11138, #11272, #11506: To help debugging, Caml_state
    now dynamically checks that the domain lock is held, and fails
    otherwise (with a fatal error at most entry points of the C API, or
    systematically in debug mode). A new variable Caml_state_opt is
    introduced, and is NULL when the domain lock is not held. This
    allows to test from C code if the current thread holds the lock of
    its domain.
    (Guillaume Munch-Maccagnoni, review by Florian Angeletti, Damien
    Doligez, Sadiq Jaffer, Xavier Leroy, and Gabriel Scherer)

  • #11223: The serialization format of custom blocks changed in 4.08,
    but the deserializer would still support the pre-4.08 format. OCaml
    5.x removed support for this old format; provide a clear error message
    in this case.
    (Hugo Heuzard, review by Gabriel Scherer)

  • #11504, #11522: Use static allocation in caml_make_float_vect in
    no-flat-float-array mode, it’s more efficient and avoids a a race condition
    (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by David Allsopp)

  • #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe
    (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy,
    review by the same)

  • #11479: Make Unix.symlink domain-safe on Windows
    (Olivier Nicole, review by Xavier Leroy and David Allsopp)

  • #11294: Switch minimum required autoconf to 2.71.
    (David Allsopp, review by Xavier Leroy)

  • #11370, #11373: Don’t pass CFLAGS to flexlink during configure.
    (David Allsopp, report by William Hu, review by Xavier Leroy and
    Sébastien Hinderer)

  • #11487: Thwart FMA test optimization during configure
    (William Hu, review by David Allsopp and Sébastien Hinderer)

  • #11468: Fix regression from #10186 (OCaml 4.13) detecting IPv6 on Windows for
    mingw-w64 i686 port.
    (David Allsopp, review by Xavier Leroy and Sébastien Hinderer)

  • #11482, #11542: Fix random crash in large closure allocation
    (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by
    Xavier Leroy)

  • #11508, #11509: make Bytes.escaped domain-safe
    (Christiano Haesbaert and Gabriel Scherer,
    review by Xavier Leroy,
    report by Jan Midtgaard and Tom Kelly)

  • #11516, #11524: Fix the deprecated_mutable attribute.
    (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional
    arrays.
    (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy
    Yallop and Florian Angeletti)

  • #11587: Prevent integer comparison from being used on pointers
    (Vincent Laviron, review by Gabriel Scherer)

Documentation changes

  • #11093: Add tutorials on parallelism features and the relaxed memory model
    (KC Sivaramakrishnan, review by Damien Doligez, Anil Madhavapeddy, Gabriel
    Scherer, Thomas Leonard, Tom Ridge, Xavier Leroy, Luc Maranget, Fabrice
    Buoro, Olivier Nicole, Guillaume Munch-Maccagnoni, Jacques-Henri Jourdan)
47 Likes