OCaml 4.12.0, first release candidate

Previous topics from @octachron on the 4.12.0 release:

(I don’t think we ever had so many preparation releases for new OCaml versions. Maybe the change is due to the ever-increasing integration with opam-repository testing led by @kit-ty-kate, where it is convenient to have fixed compiler pre-releases to test against?)

I recently worked on cleaning up the 4.12 changelog, which led me to highlight a bunch of changes that I think could be most impactful to user:

Supported platforms (highlights):

  • #9699: add support for iOS and macOS on ARM 64 bits
    (Eduardo Rafael, review by Xavier Leroy, Nicolás Ojeda Bär
    and Anil Madhavapeddy, additional testing by Michael Schmidt)

Standard library (highlights):

  • #9797: Add Sys.mkdir and Sys.rmdir.
    (David Allsopp, review by Nicolás Ojeda Bär, Sébastien Hinderer and
    Xavier Leroy)
  • [breaking change] #9765: add init functions to Bigarray.
    (Jeremy Yallop, review by Gabriel Scherer, Nicolás Ojeda Bär, and
    Xavier Leroy)

  • [breaking change] #9668: List.equal, List.compare
    (This could break code using “open List” by shadowing
    Stdlib.{equal,compare}.)
    (Gabriel Scherer, review by Nicolás Ojeda Bär, Daniel Bünzli and Alain Frisch)

  • #9066: a new Either module with
    type 'a Either.t = Left of 'a | Right of 'b
    (Gabriel Scherer, review by Daniel Bünzli, Thomas Refis, Jeremy Yallop)

  • #9066: List.partition_map :
    ('a → ('b, 'c) Either.t) → 'a list → 'b list * 'c list
    (Gabriel Scherer, review by Jeremy Yallop)

  • #9865: add Format.pp_print_seq
    (Raphaël Proust, review by Nicolás Ojeda Bär)

Compiler user-interface and warnings (highlights):

  • #9657: Warnings can now be referred to by their mnemonic name. The names are
    displayed using -warn-help and can be utilized anywhere where a warning list
    specification is expected.
    ocamlc -w +fragile-match
    …[@@ocaml.warning “-fragile-match”]
    Note that only a single warning name at a time is supported for now:
    “-w +foo-bar” does not work, you must use “-w +foo -w -bar”.
    (Nicolás Ojeda Bär, review by Gabriel Scherer, Florian Angeletti and
    Leo White)

  • #8939: Command-line option to save Linear IR before emit.
    (Greta Yorsh, review by Mark Shinwell, Sébastien Hinderer and Frédéric Bour)

  • #9003: Start compilation from Emit when the input file is in Linear IR format.
    (Greta Yorsh, review by Jérémie Dimino, Gabriel Scherer and Frédéric Bour)

Language features (highlights):

  • [breaking change] #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)

Runtime system (highlights):

  • #9534, #9947: Introduce a naked pointers checker mode to the runtime
    (configure option --enable-naked-pointers-checker). Alarms are printed
    when the garbage collector finds out-of-heap pointers that could
    cause a crash in no-naked-pointers mode.
    (Enguerrand Decorne, KC Sivaramakrishnan, Xavier Leroy, Stephen Dolan,
    David Allsopp, Nicolás Ojeda Bär review by Xavier Leroy, Nicolás Ojeda Bär)
  • [breaking change] #1128, #7503, #9036, #9722, #10069: EINTR-based signal handling.
    When a signal arrives, avoid running its OCaml handler in the middle
    of a blocking section. Instead, allow control to return quickly to
    a polling point where the signal handler can safely run, ensuring that
    I/O locks are not held while it runs. A polling point was removed from
    caml_leave_blocking_section, and one added to caml_raise.
    (Stephen Dolan, review by Goswin von Brederlow, Xavier Leroy, Damien
    Doligez, Anil Madhavapeddy, Guillaume Munch-Maccagnoni and Jacques-
    Henri Jourdan)

  • [breaking change] #5154, #9569, #9734: Add Val_none, Some_val, Is_none, Is_some,
    caml_alloc_some, and Tag_some. As these macros are sometimes defined by
    authors of C bindings, this change may cause warnings/errors in case of
    redefinition.
    (Nicolás Ojeda Bär, review by Stephen Dolan, Gabriel Scherer, Mark Shinwell,
    and Xavier Leroy)

  • [breaking change] #9674: Memprof: guarantee that an allocation callback is always run
    in the same thread the allocation takes place
    (Jacques-Henri Jourdan, review by Stephen Dolan)

  • #10025: Track custom blocks (e.g. Bigarray) with Memprof
    (Stephen Dolan, review by Leo White, Gabriel Scherer and Jacques-Henri
    Jourdan)

  • #9619: Change representation of function closures so that code pointers
    can be easily distinguished from environment variables
    (Xavier Leroy, review by Mark Shinwell and Damien Doligez)

  • #9654: More efficient management of code fragments.
    (Xavier Leroy, review by Jacques-Henri Jourdan, Damien Doligez, and
    Stephen Dolan)

Other libraries (highlights):

  • #9573: reimplement Unix.create_process and related functions without
    Unix.fork, for better efficiency and compatibility with threads.
    (Xavier Leroy, review by Gabriel Scherer and Anil Madhavapeddy)

  • #9575: Add Unix.is_inet6_addr
    (Nicolás Ojeda Bär, review by Xavier Leroy)

  • #9930: new module Semaphore in the thread library, implementing
    counting semaphores and binary semaphores
    (Xavier Leroy, review by Daniel Bünzli and Damien Doligez,
    additional suggestions by Stephen Dolan and Craig Ferguson)

  • [breaking change] #9206, #9419: update documentation of the threads library;
    deprecate Thread.kill, Thread.wait_read, Thread.wait_write,
    and the whole ThreadUnix module.
    (Xavier Leroy, review by Florian Angeletti, Guillaume Munch-Maccagnoni,
    and Gabriel Scherer)

Manual and documentation (highlights):

  • #9755: Manual: post-processing the html generated by ocamldoc and
    hevea. Improvements on design and navigation, including a mobile
    version, and a quick-search functionality for the API.
    (San Vũ Ngọc, review by David Allsopp and Florian Angeletti)

  • #9468: HACKING.adoc: using dune to get merlin support
    (Thomas Refis, review by Gabriel Scherer)

  • #9684: document in address_class.h the runtime value model in
    naked-pointers and no-naked-pointers mode
    (Xavier Leroy and Gabriel Scherer)

Internal/compiler-libs changes (highlights):

  • #9464, #9493, #9520, #9563, #9599, #9608, #9647: refactor
    the pattern-matching compiler
    (Thomas Refis and Gabriel Scherer, review by Florian Angeletti)

  • #9696: ocamltest now shows its log when a test fails. In addition, the log
    contains the output of executed programs.
    (Nicolás Ojeda Bär, review by David Allsopp, Sébastien Hinderer and Gabriel
    Scherer)

Build system (highlights):

  • #9824, #9837: Honour the CFLAGS and CPPFLAGS variables.
    (Sébastien Hinderer, review by David Allsopp)

  • #10063: (Re-)enable building on illumos (SmartOS, OmniOS, …) and
    Oracle Solaris; x86_64/GCC and 64-bit SPARC/Sun PRO C compilers.
    (partially revert #2024).
    (Tõivo Leedjärv and Konstantin Romanov,
    review by Gabriel Scherer, Sébastien Hinderer and Xavier Leroy)

The most important change, if you ask me, is from @nojb: support for mnemonic names for warnings instead of numbers. [@warning "-fragile-match"] is just so much better than [@warning "-4"]. Now we can locally disable/enable a warning.

6 Likes