OCaml 4.12.0, second alpha release

The release of OCaml 4.12.0 is approaching. We have released a second alpha
version to help fellow hackers join us early in our bug hunting and
opam ecosystem fixing fun.

Beyond the usual bug fixes this new alpha version removes the type system change that
restricted the propagation of type information between branches of a “match”.
The newly introduced warning was more troublesome than expected, the feature has
been thus postponed to 4.13 .

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

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

If you want to tweak the configuration of the compiler, you can pick configuration options with

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

where <option_list> is a comma separated list of ocaml-option-* packages. For
instance, for a flambda and afl enabled switch:

opam switch create 4.12.0~alpha2+flambda+afl --packages=ocaml-variants.4.12.0~alpha2+options,ocaml-option-flambda,ocaml-option-afl --repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

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/4.12.0-alpha2.tar.gz
https://caml.inria.fr/pub/distrib/ocaml-4.12/ocaml-4.12.0~alpha2.tar.gz

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

with

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

This alpha repository contains various packages patched with fixes in the
process of being upstreamed. Once the repository installed, these patched
packages will take precedence over the non-patched version.

If you find any bugs, please report them here:
https://github.com/ocaml/ocaml/issues

Happy hacking,

– Florian Angeletti for the OCaml team.


Changes from the first alpha:

Removed feature

-* 9811: remove propagation from previous branches
Type information inferred from previous branches was propagated in
non-principal mode. Revert this for better compatibility with
-principal mode.
For the time being, infringing code should result in a principality warning.
(Jacques Garrigue, review by Thomas Refis and Gabriel Scherer)

New bug fixes

  • [additional fixes] 9500, 9727, 9866, 9870, +9873: Injectivity annotations
    One can now mark type parameters as injective, which is useful for
    abstract types:
    module Vec : sig type !'a t end = struct type 'a t = 'a array end
    On non-abstract types, this can be used to check the injectivity of
    parameters. Since all parameters of record and sum types are by definition
    injective, this only makes sense for type abbreviations:
    type !'a t = 'a list
    Note that this change required making the regularity check stricter.
    (Jacques Garrigue, review by Jeremy Yallop and Leo White)
  • 2195: Improve error message in bytecode stack trace printing and load
    debug information during bytecode startup if OCAMLRUNPARAM=b=2.
    (David Allsopp, review by Gabriel Scherer and Xavier Leroy)

  • 10050: update {PUSH,}OFFSETCLOSURE* bytecode instructions to match new
    representation for closures
    (Nathanaël Courant, review by Xavier Leroy)

  • 10035: Make sure that flambda respects atomicity in the Atomic module.
    (Guillaume Munch-Maccagnoni, review by Gabriel Scherer)

  • 8796: On Windows, make Unix.utimes use FILE_FLAG_BACKUP_SEMANTICS flag
    to allow it to work with directories.
    (Daniil Baturin, review by Damien Doligez)

  • 10008: Improve error message for aliases to the current compilation unit.
    (Leo White, review by Gabriel Scherer)

  • 9938, 9939: Define __USE_MINGW_ANSI_STDIO=0 for the mingw-w64 ports to
    prevent their C99-compliant snprintf conflicting with ours.
    (David Allsopp, report by Michael Soegtrop, review by Xavier Leroy)

  • 7813, 9955: make sure the major GC cycle doesn’t get stuck in Idle state
    (Damien Doligez, report by Anders Fugmann, review by Jacques-Henri Jourdan)

  • 9991: Fix reproducibility for -no-alias-deps
    (Leo White, review by Gabriel Scherer and Florian Angeletti)

  • 9998: Use Sys.opaque_identity in CamlinternalLazy.force
    This removes extra warning 59 messages when compiling afl-instrumented
    code with flambda -O3.
    (Vincent Laviron, report by Louis Gesbert, review by Gabriel Scherer and
    Pierre Chambart)

  • 9999: fix -dsource printing of the pattern (A as x | (B as x)).
    (Gabriel Scherer, report by Anton Bachin, review by Florian Angeletti)

  • 9970, 10010: fix the declaration scope of extensible-datatype constructors.
    A regression that dates back to 4.08 makes extensible-datatype constructors
    with inline records very fragile, for example:
    type 'a t += X of {x : 'a}
    (Gabriel Scherer, review by Thomas Refis and Leo White,
    report by Nicolás Ojeda Bär)

6 Likes