Second beta release of OCaml 5.4.0

After an extended summer break, the release of OCaml 5.4.0 is getting close.

Since there have been a handful of meaningful bug fixes this summer, we are releasing a second beta version of OCaml 5.4.0 to help you update your software and libraries ahead of the release (see below for the installation instructions). More information about the whole release process is now available in the compiler repository.

Compared to the first beta release, this beta release contains four notable bug fixes:

  • one type system bugfix for variance annotation on private types
  • one memory concurrency safety fix for weak pointers
  • two Windows fixes

Those fixes are complemented by:

  • one runtime performance fix
  • three tools and compiler-libs related fixes
  • one error message fix.

The full list of fixes for this second beta is available below.

Overall, this beta release is already quite stable. If the tests for this beta release go well, we are expecting to have a first release candidate in the week of the 22 September, and the full release in the beginning of October.

If you find any bugs, please report them on OCaml's issue tracker.

The last progresses on stabilising the ecosystem are still tracked on the opam readiness for 5.4.0 meta-issue.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.4.0 is available on GitHub.

Happy hacking,
Florian Angeletti for the OCaml team


Installation Instructions

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

opam update
opam switch create 5.4.0~beta2

The source code for the beta is also available at these addresses:

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.4.0~beta2+options <option_list>

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

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

All available options can be listed with opam search ocaml-option.


Changes since the first beta

Type system fix

  • #14200, #14202: bad variance check with private aliases
    (Jacques Garrigue, report and review by Stephen Dolan)

Windows fixes

  • #13504, #13625, #14223: Add Thread.set_current_thread_name.
    (Romain Beauxis, review by Gabriel Scherer and Antonin Décimo)

  • #13541, #13777: Using C++11 thread_local causes name-mangling issues when linking with flexlink on Cygwin.
    (Antonin Décimo and David Allsopp, report by Kate Deplaix)

Runtime fixes

  • #14061, #14209: fix a memory-ordering bug in Weak.set that could result in uninitialized memory seen by Weak.get on another domain.
    (Damien Doligez, review by Gabriel Scherer)

  • #14169: runtime, fix cache miss within the stack fragments cache
    (Florian Angeletti, review by Gabriel Scherer)

Tooling fixes

  • #13302, #14236: Store locations of longidents components
    (Ulysse Gérard and Jules Aguillon, review by Jules Aguillon and Florian Angeletti)

  • #12642, #13536, #14184, #14192: in the toplevel, print shorter paths for constructors and labels when only some modules along their path are open.
    (Gabriel Scherer, review by Florian Angeletti)

  • #14196, #14197: ocamlprof: do not instrument unreachable clauses
    (Gabriel Scherer, review by Nicolás Ojeda Bär, report by Ali Caglayan)

Error messages

  • #14214, #14221: fix a confused error message for module inclusions, functor error messages were missing some type equalities potentially leading to nonsensical "type t is not compatible with type t" submessage
    (Florian Angeletti, report by Basile Clément, review by Gabriel Scherer)