OCaml 5.0, first normal alpha release

The stabilisation of OCaml 5.0 has been progressing well during the last month.
We have thus released a first normal alpha release of OCaml 5.0.0 to help
fellow hackers join us early in our bug hunting and opam ecosystem fixing fun
(see below for the installation instructions).

You can follow the progress in stabilising the opam ecosystem on

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

If you find any bugs, please report them here:

Issues · ocaml/ocaml · GitHub

Compared to the zeroth alpha release, this alpha release restores the support
for the bytecode debugger, and integrates a change of type in the FFI API that
might trigger some warnings in FFI code.

We also have a change in the installed files: the compiler distributes now its
own META files rather than relying on either findlib or dune to provide those
files. This should simplify the tasks of both tools in future version.

Note there are still some changes expected in the Effect module before the next
candidate release. Generally, both the Effect and Domain modules are still
experimental and might change API even during the beta releases.

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

A short summary of the changes since the zeroth 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~alpha1

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

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

If you want to test this version, it is strongly advised to install the alpha
opam repository

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~alpha1 <><><><><><><><><><><><><>
 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 in the process of being upstreamed which
vastly increases the number of opam packages currently compatible with OCaml 5.0.0 .

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~alpha1+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~alpha1+flambda+nffa ocaml-variants.5.0.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

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

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.0.0~alpha1+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.

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

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

Changes since the zeroth alpha release:

Runtime system:

  • #11400: Runtime events counters fixes
    Fixes mismatch between OCaml and C APIs, removes events from 4.x that
    are not present in the 5.0 GC and adds some missing probes.
    (Sadiq Jaffer, review by Gabriel Scherer, Florian Angeletti)

  • #11368: Runtime events buffer size OCAMLRUNPARAMS fix
    The runtime events buffer size can now be set via the ‘e’ OCAMLRUNPARAM.
    This is previously mistakenly enabled/disabled tracing instead.
    (Sadiq Jaffer, review by KC Sivaramakrishnan, David Allsopp, Damien Doligez)

  • #11304: Fix data race on Windows file descriptors
    (Olivier Nicole and Xavier Leroy, review by Xavier Leroy, David Allsopp,
    and Sadiq Jaffer)

  • (breaking change) #11337: pass ‘flags’ metadata to root scanners, to optimize stack
    scanning in the bytecode interpreter.
    Changes the interface of user-provided root-scanning hooks.
    (Gabriel Scherer, review by Xavier Leroy,
    Guillaume Munch-Maccagnoni, Sadiq Jaffer and Tom Kelly)
  • #11144: Restore frame-pointers support for amd64
    (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan)
  • (breaking change) #11255: in the C interface, &Field(v, i) now has type volatile value *
    instead of value * in OCaml 4. This makes the memory model
    for mixed OCaml/C code better defined, but can cause warnings or type
    errors in user C code.
    (KC Sivaramakrishnan, review by Xavier Leroy, Gabriel Scherer and
    Guillaume Munch-Maccagnoni, additional discussions with Stephen
    Dolan and Luc Maranget)

Standard library:

  • #10867, +#11345: Remove deprecated values:
    …, the infix operator (.[ ]<-).
    (Nicolás Ojeda Bär, review by Damien Doligez)
  • #11309, #11424, #11427: Add Domain.recommended_domain_count.
    (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp,
    KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar)

Tools:

  • #11065: Port the bytecode debugger to 5.0, adding support for effect handlers.
    (Damien Doligez and fabbing, review by fabbing and Xavier Leroy)

  • #11382: OCamlmktop use a new initialization module “OCamlmktop_init” to
    preserve backward-compatibility with user-module provided modules that install
    toplevel printers.
    (Florian Angeletti, review by Gabriel Scherer and David Allsopp)

Installation:

  • #11007, #11399: META files for the stdlib, compiler-libs and other libraries
    (unix, dynlink, str, runtime_events, threads, ocamldoc) are now installed
    along with the compiler.
    (David Allsopp, Florian Angeletti, Nicolás Ojeda Bär and Sébastien Hinderer,
    review by Daniel Bünzli, Kate Deplaix, Anil Madhavapeddy and Gabriel Scherer)

Bug fixes:

  • #10768, #11340: Fix typechecking regression when combining first class
    modules and GADTs.
    (Jacques Garrigue, report by François Thiré, review by Matthew Ryan)

  • #10790: don’t drop variance and injectivity annotations when pretty printing
    with constraints (for example, with type +!'a t = ...).
    (Florian Angeletti, report by Luke Maurer, review by Matthew Ryan and
    Gabriel Scherer)

  • #11289, #11405: fix some leaks on systhread termination
    (Fabrice Buoro, Enguerrand Decorne, Gabriel Scherer,
    review by Xavier Leroy and Florian Angeletti, report by Romain Beauxis)

  • #11314, #11416: fix non-informative error message for module inclusion
    (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer)

  • #11358, #11379: Refactor the initialization of bytecode threading,
    This avoids a “dangling pointer” warning of GCC 12.1.
    (Xavier Leroy, report by Armaël Guéneau, review by Gabriel Scherer)

  • #11387, module type with constraints no longer crash the compiler in presence
    of both shadowing warnings and the -bin-annot compiler flag.
    (Florian Angeletti, report by Christophe Raffalli, review by Gabriel Scherer)

30 Likes