First alpha release of OCaml 5.4.0

Four months after the release of OCaml 5.3.0, the set of new features for the
future version 5.4.0 of OCaml has been frozen. We are thus happy to announce the
first alpha release for OCaml 5.4.0.

This alpha version is here to help fellow hackers join us early in our bug
hunting and opam ecosystem fixing fun (see below for the installation
instructions) [1].

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

The full release is expected around the end of July [2].

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

If you are interested in the ongoing list of new features and bug fixes, you can have a look at
the changelog for OCaml 5.4.0.

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~alpha1

The source code for the alpha 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~alpha1+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~alpha1+flambda+nffa ocaml-variants.5.4.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

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


  1. The release process is described at ocaml/release-info/introduction.md at trunk · ocaml/ocaml · GitHub . ↩︎

  2. See also the prospective release calendar. ↩︎

26 Likes

Wow, the changelog for 5.4 is, to me, the most exciting one since I first tried OCaml back in 2019. Immutable arrays[1] (with syntax!), labeled tuple fields, Char.Ascii, so many helpers for Result, String, List, Seq, Array… And presumably a fix for the GC-pacing issues (which my meagre workloads did not hit)?

I’m really curious as to how [%atomic.loc] is implemented in the type checker and whether it will grow into a proper feature eventually, it looks like a second-class version of F#'s byref/inref/outref[2].


  1. I can’t believe OCaml got them before F#. ↩︎

  2. Although those are already second-class. Third-class? ↩︎

2 Likes

And presumably a fix for the GC-pacing issues

About this fix, there is more to come in 5.5, waiting for feedback from real world use at janestreet, right?

There are more GC-pacing fixes planned in future releases, not really tied to only Janestreet feedback. Typically, the on-fly update of GC parameters described in Upgrading Semgrep from OCaml 4 to OCaml 5 | Semgrep should not be needed once all the pacing bugs in the GC are fixed.

1 Like

Just to be clear: to my knowledge there is no notable GC-pacing improvement in 5.4 compared to 5.3 – it’s just that people working on it understand the problem better. There also hasn’t been a working PR proposed, so I cannot say for sure whether something will happen by the 5.5 timeline. (I’m not currently working on this myself, so this is indirect news from corridor discussions with @stedolan, @nickbarnes and @damiendoligez .)

1 Like

One thing to note in the Language Features section you are referring to, which I agree is more impressive than typical, is that it includes two medium-sized changes (immutable arrays and labeled tuples) that were designed and developed by Jane Street and later proposed for upstreaming (for immutable arrays, @otini from Tarides did the upstreaming).

This might be the first time this happens since Jane Street switched from upstream-first to fork-first development, and it required efforts on both sides, both the technical work of writing and reviewing the upstream change proposals (design and implementation) but also finding processes to do this that work for everyone involved. It’s more difficult than it looks like, and I’m happy with this particular pair of results.

9 Likes