OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

We have the pleasure of celebrating the anniversary of Olympe de Gouges' "Declaration of the Rights of Woman and of the Female Citizen" by announcing the release of OCaml version 5.1.0.

Some of the highlights in OCaml 5.1.0 are:

  • Many runtime performance regression and memory-leaks fixes (dynlinking, weak array, weak hash sets, GC with idle domains, GC prefetching)
  • Restored support for native code generation on RISC-V and s390x architectures
  • Restored Cygwin port
  • Reduced installation size (50% reduction)
  • Compressed compilation artefacts (.cmi, .cmt, .cmti, .cmo, .cma files)
  • 19 error message improvements
  • 14 standard library functions made tail-recursive with Tail-Recursion-Modulo-Cons (TRMC), such as List.append and List.map
  • 57 new standard library functions
  • More examples in the standard library documentation
  • 42 bug fixes

OCaml 5.1.0 is still a relatively experimental release compared to the OCaml 4.14 branch. In particular:

  • The POWER port is being tested in the dev version of the compiler.
  • The Windows MSVC port is still unavailable.
  • Ephemeron performances need to be investigated.
  • GC compaction is a work in progress.
  • statmemprof is a work in progress.
  • There are a number of known runtime concurrency bugs (that trigger under rare circumstances).

We are planning to address those regressions, hopefully in time for the OCaml 5.2.0 release for some of them. Meanwhile, the OCaml 4.14 branch will be maintained, and the next release on the OCaml 4.14 branch, OCaml 4.14.2, should follow this release in the upcoming months.

Please report any unexpected behaviours on the OCaml issue tracker and post any questions or comments you might have on our discussion forums.

The full list of changes can be found in the changelog below.


Installation Instructions

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

opam update
opam switch create 5.1.0

The source code for the release candidate is also directly available on:

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.1.0+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.1.0+flambda+nffa ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog

Restored backends

  • #11418, #11708: RISC-V multicore support. (Nicolás Ojeda Bär, review by KC Sivaramakrishnan)

  • #11712, #12258, #12261: s390x / IBM Z multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. (Aleksei Nikiforov, with help from Vincent Laviron and Xavier Leroy, additional suggestions by Luc Maranget, review by the same and KC Sivaramakrishnan)

  • #11642: Restore Cygwin port. Add GC messages for address space reservations when OCAMLRUNPARAM option v includes 0x1000. (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni and Gabriel Scherer)

Standard library:

  • #12006, #12064: Add Marshal.Compression flag to Marshal.to_* functions. When this flag is explicitly set, marshaled data is compressed using ZSTD. On some practical examples, the marshalled output became three times smaller at no noticeable cost on the marshalling time. (Xavier Leroy, review by Edwin Török and Gabriel Scherer, fix by Damien Doligez)

  • #10464: Add List.is_empty. (Craig Ferguson, review by David Allsopp)

  • #11848: Add List.find_mapi, List.find_index: ('a -> bool) -> 'a list -> int option, Seq.find_mapi, Seq.find_index, Array.find_mapi, Array.find_index, Float.Array.find_opt, Float.Array.find_index, Float.Array.find_map, Float.Array.find_mapi. (Sima Kinsart, review by Daniel Bünzli and Nicolás Ojeda Bär)

  • #11410: Add Set.to_list, Map.to_list, Map.of_list, Map.add_to_list: key -> 'a -> 'a list t -> 'a list t. (Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #11836, #11837: Add Array.map_inplace, Array.mapi_inplace, Float.Array.mapi_inplace and Float.Array.mapi_inplace. (Léo Andrès, review by Gabriel Scherer, KC Sivaramakrishnan and Nicolás Ojeda Bär)

  • #10967: Add Filename.temp_dir. (David Turner, review by Anil Madhavapeddy, Valentin Gatien-Baron, Nicolás Ojeda Bär, Gabriel Scherer, and Daniel Bünzli)

  • #11246: Add "hash" and "seeded_hash" functions to Bool, Int, Char, Float, Int32, Int64, and Nativeint. (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer)

  • #11488: Add Mutex.protect: Mutex.t -> (unit -> 'a) -> 'a for resource-safe critical sections protected by a mutex. (Simon Cruanes, review by Gabriel Scherer, Xavier Leroy, Guillaume Munch-Maccagnoni)

  • #11581: Add type equality witness type (_, _) eq = Equal: ('a, 'a) eq in a new module Stdlib.Type. (Nicolás Ojeda Bär, review by Daniel Bünzli, Jacques Garrigue, Florian Angeletti, Alain Frisch, Gabriel Scherer, Jeremy Yallop and Xavier Leroy)

  • #11843: Add In_channel.input_lines and In_channel.fold_lines. (Xavier Leroy, review by Nicolás Ojeda Bär and Wiktor Kuchta).

  • #11856, #11859: Using TRMC, the following Stdlib functions are now tail-recursive: Stdlib.(@), List.append, List.concat_map. (Jeremy Yallop, review by Daniel Bünzli, Anil Madhavapeddy, Nicolás Ojeda Bär, Gabriel Scherer, and Bannerets)

  • #11362, #11402: Using TRMC, the following Stdlib functions are now tail-recursive: List.map, List.mapi, List.map2, List.filter, List.filteri, List.filter_map, List.init, List.of_seq. (Nicolás Ojeda Bär, review by Xavier Leroy and Gabriel Scherer)

  • #11878, #11965: Prevent seek_in from marking buffer data as valid after closing the channel. This could lead to inputting uninitialized bytes. (Samuel Hym, review by Xavier Leroy and Olivier Nicole)

  • #11128: Add In_channel.isatty, Out_channel.isatty. (Nicolás Ojeda Bär, review by Gabriel Scherer and Florian Angeletti)

  • #10859: Add Format.pp_print_iter and Format.pp_print_array. (Léo Andrès and Daniel Bünzli, review by David Allsopp and Hugo Heuzard)

  • #10789: Add Stack.drop (Léo Andrès, review by Gabriel Scherer)

  • (breaking change) #10899: Change Stdlib.nan from signaling NaN to quiet NaN. (Greta Yorsh, review by Xavier Leroy, Guillaume Melquiond and Gabriel Scherer)
  • #11026, #11667, #11858: Rename the type of the accumulator of fold functions to 'acc: fold_left : ('acc -> 'a -> 'acc) -> 'acc -> 'a list -> 'acc fold_right : ('a -> 'acc -> 'acc) -> 'a list -> 'acc -> 'acc fold_left_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a list -> 'acc * 'b list ... (Valentin Gatien-Baron and Francois Berenger, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • #11354: Hashtbl.find_all is now tail-recursive. (Fermín Reig, review by Gabriel Scherer)

  • #11500: Make Hashtbl.mem non-allocating. (Simmo Saan, review by Nicolás Ojeda Bär)

  • #11412: Add Sys.is_regular_file (Xavier Leroy, review by Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp)

  • #11322, #11329: serialization functions Random.State.{of,to}_binary_string between Random.State.t and string (Gabriel Scherer, report by Yotam Barnoy, review by Daniel Bünzli, Damien Doligez, Hugo Heuzard and Xavier Leroy)

  • #11830: Add Type.Id with val provably_equal : 'a Type.Id.t -> 'b Type.Id.t -> ('a, 'b) Type.eq option (Daniel Bünzli, review by Jeremy Yallop, Gabriel Scherer, Wiktor Kuchta, Nicolás Ojeda Bär)

  • #12184, #12320: Sys.rename Windows fixes on directory corner cases. (Jan Midtgaard, review by Anil Madhavapeddy)

  • (breaking change) #11565: Enable -strict-formats by default. Some incorrect format specifications (for printf) where silently ignored and now fail. Those new failures occur at compile-time, except if you use advanced format features like %(...%) that parse format strings dynamically. Pass -no-strict-formats to revert to the previous lenient behavior. (Nicolás Ojeda Bär, review by David Allsopp)

Installation size

Specific efforts have been made during this release to reduce the filesystem size of installed artifacts of the compiler distribution. The installation size of 5.1 is 272 MiB compared to 521 MiB for 5.0. Some of those changes will benefit all OCaml packages.

  • ocaml/RFCs#23, #12006: use compressed marshaled format from #12006 for .cmi, .cmt, .cmti files, and for debug info in .cmo and .cma files, resulting in major reduction in size. (Xavier Leroy, review by Edwin Török and Gabriel Scherer, RFC by Simon Cruanes)

  • #11981: Reduce size of OCaml installations by removing debugging information from installed bytecode executables. It is no longer possible to run ocamldebug over these installed bytecode executables, nor to get exception backtraces for them. (Xavier Leroy, review by David Allsopp, report by Fabrice Le Fessant)

  • (breaking change) #11993: install only bytecode executables for the ocamlmklib, ocamlcmt, ocamlprof, ocamlcp, ocamloptp, and ocamlmktop tools, but no native-code executables. A tool like ocamlmklib for example is now installed directly to $BINDIR/ocamlmklib; ocamlmklib.byte and ocamlmklib.opt are no longer installed to $BINDIR. (Xavier Leroy, review by Gabriel Scherer)

Runtime system:

  • #11589, #11903: Modify the GC pacing code to make sure the GC keeps up with allocations in the presence of idle domains. (Damien Doligez and Stephen Dolan, report by Florian Angeletti, review by KC Sivaramakrishnan and Sadiq Jaffer)

  • #11743: Speed up weak array operations (KC Sivaramakrishnan, review by François Bobot and Sadiq Jaffer)

  • #12131: Simplify implementation of weak hash sets, fixing a performance regression. (Nick Barnes, review by François Bobot, Alain Frisch and Damien Doligez).

  • #11474, #11998, #12065: Add support for user-defined events in the runtime event tracing system. (Lucas Pluvinage, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni, Enguerrand Decorne, Gabriel Scherer and Anil Madhavapeddy)

  • #11827, #12249: Restore prefetching for GC marking (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer)

  • #11144: Restore frame-pointers support for amd64 (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan)

  • #11935: Load frametables of dynlink'd modules in batch (Stephen Dolan, review by David Allsopp and Guillaume Munch-Maccagnoni)

  • #11284, #12525: Use compression of entries scheme when pruning mark stack. Can decrease memory usage for some workloads, otherwise should be unobservable. (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer and Damien Doligez)

  • (breaking change) #11865, #11868, #11876: Clarify that the operations of a custom block must never access the OCaml runtime. The previous documentation only mentioned the main illicit usages. In particular, since OCaml 5.0, it is no longer safe to call caml_remove_global_root or caml_remove_generational_global_root from within the C finalizer of a custom block, or within the finalization function passed to caml_alloc_final. As a workaround, such a finalization operation can be registered with Gc.finalize instead, which guarantees to run the finalizer at a safe point. (Report by Timothy Bourke, discussion by Yotam Barnoy, Timothy Bourke, Sadiq Jaffer, Xavier Leroy, Guillaume Munch-Maccagnoni, and Gabriel Scherer)
  • #12130: Fix multicore crashes with weak hash sets. Fixes #11934. (Nick Barnes, review by François Bobot)

  • #12099: Add ocamlrund option, -events, to produce a trace of debug events during bytecode interpretation. Fixes #12098. (Richard L Ford, review by Gabriel Scherer)

  • #12001: Fix book keeping for last finalisers during the minor cycle (KC Sivaramakrishnan and Enguerrand Decorne, report by Guillaume Bury and Vincent Laviron, review by Sadiq Jaffer and KC Sivaramakrishnan)

  • #11919: New runtime events counters for major heap stats and minor heap resizing. (Sadiq Jaffer, review by Gabriel Scherer and David Allsopp)

  • #11287, #11872, #11955: Clean up reserved header bits (once used for Spacetime profiling). (Nick Barnes, review by Gabriel Scherer and Damien Doligez)

  • #11750: Decouple major slice from minor GC. (KC Sivaramakrishnan, review by Sadiq Jaffer, Guillaume Munch-Maccagnoni and Damien Doligez)

  • #11796: protect lazy computation of code fragment digest by a mutex. This makes the thread sanitizer happier, and avoids duplicating the hashing work. (Gabriel Scherer, review by Xavier Leroy, report by Olivier Nicole)

  • #11137: new Unsafe_store_tag(val, new_tag) macro to stop using Tag_val(val) as lvalue. (Gabriel Scherer, review by Xavier Leroy, Guillaume Munch-Maccagnoni and Nicolás Ojeda Bär)

  • #11880: Restore the correct sigmask in systhreads. (Christiano Haesbaert, review by Guillaume Munch-Maccagnoni and Sébastien Hinderer)

  • #11881: Fix thread-unsafety of registration of operations for "custom" values. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11980: fix quadratic behavior in natdynlink by using a STW section for frame-descriptor updates. (Gabriel Scherer, review by Sadiq Jaffer, report by André Maroneze for Frama-C and Guillaume Melquiond for Coq)

  • #12121: unrooted implementations of caml_callback*_exn (Gabriel Scherer, review by KC Sivaramakrishnan and Xavier Leroy)

  • #3921, #12039, #12128: poll for signals in long-running polymorphic comparisons. (B. Szilvasy, Gabriel Scherer and Xavier Leroy, review by Stefan Muenzel, Guillaume Munch-Maccagnoni and Damien Doligez)

  • #12231: Support MinGW-w64 11.0 winpthreads library, where the macro to set up to get flexdll working changed (David Allsopp and Samuel Hym, light review by Xavier Leroy)

Language features:

  • (breaking change) #11694: Add short syntax for generative functor types () -> ... (Jeremy Yallop, review by Gabriel Scherer, Nicolás Ojeda Bär, Jacques Garrigue)

  • (breaking change) #11457: Remove old polymorphic variant syntax. With type t = [ `A | `B ], one could use the syntax #t in types, where it means the same thing as [< t], and in patterns, where it means (`A | `B). The use of #t in types for polymorphic variants was deprecated since 2001, and is now removed. The syntax remains available in patterns, or for objects -- when t is a class type. (Stefan Muenzel, review by Gabriel Scherer and Jacques Garrigue)

  • (breaking change) #11984: Add dedicated syntax for generative functor application. Previously, OCaml did not distinguish between F () and F (struct end), even though the latter looks applicative. Instead, the decision between generative and applicative functor application was made based on the type of F. With this patch, we now distinguish these two application forms; writing F (struct end) for a generative functor leads to new warning 73. (Frederic Bour and Richard Eisenberg, review by Florian Angeletti)

  • #9975, #11365: Make empty types (type t = |) immediate. (Antal Spector-Zabusky, review by Gabriel Scherer)

Type system:

  • (breaking change) #6941, #11187, #12483: prohibit using classes through recursive modules inheriting or including a class belonging to a mutually-recursive module would previous behave incorrectly, and now results in a clean error. (Leo White, review by Gabriel Scherer and Florian Angeletti)

  • (breaking change) #12189, #12211: anonymous row variables in explicitly polymorphic type annotation, e.g. 'a. [< X of 'a ] -> 'a, are now implicitly universally quantified (in other words, the example above is now read as 'a 'r. ([< X of 'a ] as 'r) -> 'a). (Florian Angeletti and Gabriel Scherer, review by Jacques Garrigue)

Code generation and optimizations:

  • #11967: Remove traces of Obj.truncate, which allows some mutable loads to become immutable. (Nick Barnes, review by Vincent Laviron and KC Sivaramakrishnan)

  • #9945, #10883: Turn boolean-result float comparisons into primitive operations Uses the architecture's elementary operations for float comparisons, when available, rather than branching and then setting the return value. (Stefan Muenzel, review by Stephen Dolan, Alain Frisch and Vincent Laviron)

  • #8998, #11321, #11430: change mangling of OCaml long identifiers from camlModule__name_NNN to camlModule.name_NNN. The previous mangling schema, using __, was ambiguous. (Xavier Leroy, report by sliquister and Michael Bacarella, review by Gabriel Scherer)

  • #10834: The -safer-matching option disables type-based optimizations of pattern-matching compilation. This allows to produce a match failure if a pattern-matching was wrongly assumed to be exhaustive. Since the exhaustiveness check for GADTs has had bugs in the past, it may be useful if you need extra security with GADTs. (Jacques Garrigue, review by Gabriel Scherer)

  • #11102: Speed up register allocation by permanently spilling registers (Stephen Dolan, review by Xavier Leroy)

  • #11383: Restrict the local function optimisation to forbid moving code inside a sub-function (Vincent Laviron, review by Gabriel Scherer)

  • #11686: Better spilling heuristic for the Linear Scan allocator for more efficient stack usage. (Nicolás Ojeda Bär, Gabriel Scherer, Alain Frisch, review by Gabriel Scherer, Alain Frisch and Nathanaëlle Courant)

  • #11904: Remove arm, i386 native-code backends that were already disabled at configuration time. (Nicolás Ojeda Bär, review by Stephen Dolan, Anil Madhavapeddy, and Xavier Leroy)

  • #11134: Optimise 'include struct' in more cases (Stephen Dolan, review by Leo White and Vincent Laviron)

Other libraries:

  • #11374: Remove pointer cast to a type with stricter alignment requirements in Windows implementation of Unix.gettimeofday. Windows implementations of caml_unix_map_file, caml_unix_lseek and caml_unix_lseek_64 now release the runtime lock. Windows implementation of caml_unix_lockf modernised and simplified. Where possible, 64 bit integers are used instead of LARGE_INTEGER structs. (David Allsopp, review by Jonah Beckford and Xavier Leroy)

  • #11475: Make Unix terminal interface bindings domain-safe (Olivier Nicole and Xavier Leroy, review by Xavier Leroy)

  • #11775: Unix.write on a non-blocking socket under Windows will return normally if the write blocks after some data has already been written (as otherwise there is no way of knowing how much data has been written before blocking). The same behaviour was already present under Unix. (Nicolás Ojeda Bär, review by David Allsopp)

  • (breaking change) #11991: Unix on Windows: map ERROR_TOO_MANY_LINKS to EMLINK. (Nicolás Ojeda Bär)
  • #12067: Document Windows specific meanings of Unix.process_status type (Samuel Hym, review by David Allsopp)

  • #12072: Document and test that Sys.rename works over directories too (Jan Midtgaard, review by Anil Madhavapeddy and Xavier Leroy)

Tools:

  • #11889, #11978: ocamldoc: handle injectivity annotations and wildcards in type parameters. (Florian Angeletti, report by Wiktor Kuchta, review by Jules Aguillon)

  • #11787: Fix GDB scripts to work with OCaml 5's heap layout. (Nick Barnes)

  • #11772: fix ocamlyacc's handling of raw string literals (Demi Marie Obenour)

  • #9290: Add a directive to switch off debugging in toplevel. This allows to see optimized bytecode with -dlambda. (Jacques Garrigue, review by Gabriel Scherer)

  • #11166: ocamllex: the union of two character sets "cset1 | cset2" can now be used in any context where a character set is expected. (Nicolás Ojeda Bär, Martin Jambon, review by Sébastien Hinderer)

  • #11718: ocamlyacc: OCaml-style comments are now supported, in addition to the C-style comments already supported. The syntax is the same as that used in OCaml code. (Demi Marie Obenour, review by Damien Doligez)

  • #11728: ocamlyacc: generate line directives for %type declarations (Demi Marie Obenour, review by Damien Doligez)

  • #11773: ocamlyacc: Do not allow quoted literals (such as 'a' or "bc") in a token name or %type declaration. Previously such literals were accepted by ocamlyacc, but produced malformed OCaml that was rejected by the compiler. (Demi Marie Obenour, review by Gabriel Scherer)

  • #11774: ocamlyacc: fail if there is an I/O error (Demi Marie Obenour, review by Gabriel Scherer)

  • #11973: Add support for postfixed mingw host triplets (Romain Beauxis)

  • #12165: ocamldoc, use standard doctype to avoid quirk mode. (Florian Angeletti, review by Gabriel Scherer)

Manual and documentation:

  • #11476: Add examples in documentation of Hashtbl, Queue, Atomic, Format (Simon Cruanes, review by Yotam Barnoy, Gabriel Scherer, Daniel Bünzli, Ulugbek Abdullaev, and Nicolás Ojeda Bär)

  • #11883, #11884: Update documentation for In_channel and Out_channel with examples and sections to group related functions. (Kiran Gopinathan, review by Daniel Bünzli and Xavier Leroy)

  • #12095, #12097: Put the sample code of the user's manual and reference documentation of the standard library under the CC0 1.0 Universal (CC0 1.0) Public Domain Dedication license.

  • #11892: Document the semantic differences of Unix.exec* between Unix and Windows. (Boris Yakobowski, review by Daniel Bünzli, Gabriel Scherer and Nicolás Ojeda Bär)

  • #9430, #11291: Document the general desugaring rules for binding operators. (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #11481: Fix the type of Unix.umask to Unix.file_perm -> Unix.file_perm (Favonia, review by Sébastien Hinderer)

  • #11514: Document ocamltest builtin variables and actions (Olivier Nicole, review by Sébastien Hinderer)

  • #11676: Fix missing since annotation in the Sys and Format modules (Github user Bukolab99, review by Florian Angeletti)

  • #12028: Update format documentation to make it clearer that pp_print_newline flushes its newline (Florian Angeletti, review by Gabriel Scherer)

  • #12201: in the tutorial on modules, replace priority queue example by a simpler example based on FIFO queues. (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär).

  • #12352: Fix a typo in the documentation of Arg.write_arg (Christophe Raffalli, review by Florian Angeletti)

  • #7179, #11894: correct the description of CAMLreturn and CAMLreturn0 in the Interfacing C page and memory.h file. (Dong An, review by Guillaume Munch-Maccagnoni and Olivier Nicole )

Compiler user-interface and warnings:

  • #10647: Show hints for the "undefined global" error in the toplevel (Wiktor Kuchta, review by Gabriel Scherer)

  • #12116: Don't suggest to insert a semicolon when the type is not unit (Jules Aguillon, review by Florian Angeletti)

  • #11679: Improve the error message about too many arguments to a function (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti)

  • #10009: Improve the error reported by mismatched struct/sig and =/: in module and module type bindings. (Jules Aguillon, review by Gabriel Scherer)

  • #11530: Include kinds in kind mismatch error message. "Error: This variant or record definition does not match that of type M.t The original is abstract, but this is a record". (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti)

  • #11646: Add colors to error message hints. (Christiana Anthony, review by Florian Angeletti)

  • #11235, #11864: usage warnings for constructors and fields can now be disabled on field-by-field or constructor-by-constructor basis (Florian Angeletti, review by Gabriel Scherer)

  • #11888: Improve the error message when type variables cannot be deduced from the type parameters: Before: "Error: In this definition, a type variable cannot be deduced from the type parameters." After: "Error: In the GADT constructor T : 'a -> 'a s t the type variable 'a cannot be deduced from the type parameters." (Stefan Muenzel, review by Florian Angeletti and Gabriel Scherer)

  • #10818: Preserve integer literal formatting in type hint. (Leonhard Markert, review by Gabriel Scherer and Florian Angeletti)

  • #11338: Turn some partial application warnings into hints. (Leo White, review by Stephen Dolan)

  • #10931: Improve warning 14 (illegal backslash) with a better explanation of the causes and how to fix it. (David Allsopp, Florian Angeletti, Lucas De Angelis, Gabriel Scherer, review by Nicolás Ojeda Bär, Florian Angeletti, David Allsopp and Gabriel Scherer)

  • #10911: Improve the location reported by parenthesized assert expressions (Fabian Hemmer, review by Gabriel Scherer)

  • #1391, #7645, #3922: Add an early error when compiling different modules with mismatching -for-pack (Pierre Chambart and Vincent Laviron, review by Mark Shinwell)

  • #11297: Report "unclosed" error when "done" is missing in a "do .. done" construct. (Nicolás Ojeda Bär, review by Gabriel Scherer)

  • #11635, #5461, #10564: turn warning 31 (Module_linked_twice) into a hard error for ocamlc — this was already an error with ocamlopt. (Hugo Heuzard, review by Valentin Gatien-Baron and Gabriel Scherer)

  • #11653: Add the -no-absname option to ocamlc, ocamlopt and ocamldep. (Abiola Abdulsalam, review by Sébastien Hinderer and Florian Angeletti)

  • #11696: Add the -no-g option to ocamlc and ocamlopt. (Abiola Abdulsalam, review by Sébastien Hinderer, Nicolás Ojeda Bär and Florian Angeletti)

  • #11722: clearer error messages on non-well-founded type definitions (Gabriel Scherer, review by Jacques Garrigue)

  • #11819: make the native_compiler and native_dynlink configuration variables available through ocamlc -config. (Sébastien Hinderer, review by Gabriel Scherer and David Allsopp)

  • #8602, #11863: Add -stop-after lambda flag option (Douglas Smith and Dmitrii Kosarev, review by Gabriel Scherer)

  • #11910: Simplify naming convention for shadowed or ephemeral identifiers in error messages (eg: Illegal shadowing of included type t/2 by t) (Florian Angeletti, review by Jules Aguillon)

  • #12024: insert a blank line between separate compiler messages (Gabriel Scherer, review by Florian Angeletti, report by David Wong)

  • #12088, #9265, #11949: ocamldebug: fix confusing repeating behavior on blank lines within source scripts (Damien Doligez, review by Gabriel Scherer, report by Gaëtan Gilbert)

  • #12107: use aliases to mark weak row variables: _[< ... ], < _..>, _#ct are now rendered as [< ...] as '_weak1, < .. > as '_weak1, and #ct as '_weak1. (Florian Angeletti, suggestion by Stefan Muenzel, review by Gabriel Scherer)

  • #12051: Improve the error messages when type variables cannot be generalized (Stefan Muenzel, review by Florian Angeletti)

  • (breaking change) #12094: Trigger warning 5 (ignored-partial-application) when the scrutinee of a pattern matching is of arrow type and all cases match wildcard or exception patterns. (Nicolás Ojeda Bär, review by Gabriel Scherer)

Internal/compiler-libs changes:

  • #11018, #11869: Clean up Types.Variance, adding a description of the lattice used, and defining explicitly composition. (Jacques Garrigue, review by Gabriel Scherer and Jeremy Yallop)

  • #11536: Introduce wrapper functions for level management ([Ctype.with_level], etc) and for type variable scoping ([Typetexp.with_local_type_variable_scope]). The older API ([Ctype.(begin_def,end_def)], [Typetexp.(narrow,widen)], etc.) is now removed. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #11601, #11612, #11628, #11613, #11623, #12120 : Clean up some global state handling in emitcode, bytepackager, bytegen, bytesections, spill. (Hugo Heuzard, Stefan Muenzel, review by Vincent Laviron, Gabriel Scherer and Nathanaëlle Courant)

  • #12119, #12188, #12191: mirror type constraints on value binding in the parsetree: the constraint typ in let pat : typ = exp is now directly stored in the value binding node in the parsetree. (Florian Angeletti, review by Richard Eisenberg)

  • #11912: Refactoring handling of scoped type variables (Richard Eisenberg, review by Gabriel Scherer and Florian Angeletti)

  • #11691, #11706: use asm instead of asm for strict ISO C conformance (Xavier Leroy, report by Gregg Reynolds , review by Sadiq Jaffer)

  • #11764: add prototypes to old-style C function definitions and declarations (Antonin Décimo, review by Xavier Leroy)

  • #11693: Remove use of C99 Variable Length Arrays (VLAs) in the runtime. (David Allsopp, review by Xavier Leroy, Guillaume Munch-Maccagnoni, Stefan Muenzel and Gabriel Scherer)

  • #12138: Generalise interface for BUILD_PATH_PREFIX_MAP mapping. Absolute paths are now rewritten too. (Richard L Ford, suggestions and review by Gabriel Scherer)

  • #10512: explain the compilation strategy for switches on constructors (Gabriel Scherer, review by Vincent Laviron)

  • #11990: Improve comments and macros around frame descriptors. (Nick Barnes, review by Gabriel Scherer)

  • #11847, #11849, #11851, #11898: small refactorings in the type checker (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #11027: Separate typing counter-examples from type_pat into retype_pat; type_pat is no longer in CPS. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #11286, #11515: disambiguate identifiers by using how recently they have been bound in the current environment (Florian Angeletti, review by Gabriel Scherer)

  • #11364: Allow make -C testsuite promote to take TEST and LIST variables (Antal Spector-Zabusky, review by Gabriel Scherer and David Allsopp)

  • #11446: document switch compilation (lambda/switch.ml) (Gabriel Scherer, review by Luc Maranget and Vincent Laviron)

  • #11568: Encode inline record types in Path.t (Leo White and Hyunggyu Jang, review by Gabriel Scherer)

  • #11569: Remove hash type encoding (Hyunggyu Jang, review by Gabriel Scherer and Florian Angeletti)

  • #11627: use return values instead of globals for linear scan intervals (Stefan Muenzel, review by Nicolás Ojeda Bär)

  • #11634: Dll.open_dll now properly handles opening for execution while already opened for checking (Hugo Heuzard, review by Nicolás Ojeda Bär)

  • (breaking change) #11745, #12358: Debugger and toplevels: embed printer types rather than reading their representations from topdirs.cmi at runtime. This change also removes the ocamlmktop initialization module introduced in #11382 which was no longer useful. This change breaks toplevel scripts relying on the visibility of Topdirs in the initial toplevel environment without loading topfind. Since the opam default .ocamlinit file loads topfind, it is expected that only scripts run with ocaml -noinit are affected. For those scripts, accessing Topdirs now requires the compiler-libs directory to be added to the toplevel search path with
      #directory "+compiler-libs";;
    
    as was already the case for the other modules in the toplevel interface library. (Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär and Gabriel Scherer)
  • #11615: remove global variables form asmcomp/linearize.ml (Stefan Muenzel, review by Nicolás Ojeda Bär

  • #10856: Add location, attribute(s) visitors to Tast_mapper/Tast_iterator (Yan Dong, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #11763, #11759, #11861: Enable stricter C compilation warnings, use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp and Sébastien Hinderer)

  • #11933: Use the correct machtype when reading the code pointer from closures (Nathanaëlle Courant, review by Gabriel Scherer and Vincent Laviron)

  • #11972: refactor runtime/frame_descriptors.c in preparation for quadratic-time fix (Gabriel Scherer, review by Enguerrand Decorne)

  • #11997: translate structured constants into their Obj.t representation at compile time rather than link time. Changes the way dumpobj prints these constants because their representation becomes untyped. (Sébastien Hinderer, review by Xavier Leroy, Nicolás Ojeda Bär and Hugo Heuzard)

  • #12011: remove Ctype.reified_var_counter (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer)

  • #12012: move calls to Typetexp.TyVarEnv.reset inside with_local_level etc. (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #12034: a logarithmic algorithm to find the next free variable (Gabriel Scherer, review by Stefan Muenzel)

  • #12092: remove Lev_module_definition from lambda (Nick Roberts, review by Gabriel Scherer)

  • #12117: Remove arity-interrupting elaboration of module unpacks (Nick Roberts, review by Richard Eisenberg and Jacques Garrigue)

  • #12118: stop storing names of predefined exceptions in the cu_required_globals field of compilation unit descriptors. (Sébastien Hinderer, review by Vincent Laviron)

  • #12125: Add Misc.print_see_manual and modify [@manual_ref] to accept lists for simpler printing of manual references (Stefan Muenzel, review by Florian Angeletti)

  • #12509: Use strict prototypes on primitives when generating a standalone bytecode executable (ocamlc -custom). (Antonin Décimo, review by Xavier Leroy)

Build system:

  • #11844: Reduce verbosity of make logs by printing program invocations in shorthand (eg OCAMLC foo.cmo). Setting V=1 recovers the old style (with full command-lines). (Xavier Leroy, Nicolás Ojeda Bär, review by Sébastien Hinderer)

  • #11590: Allow installing to a destination path containing spaces. (Élie Brami, review by Sébastien Hinderer and David Allsopp)

  • #11243, #11248, #11268, #11420, #11675: merge the sub-makefiles into the root Makefile. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #11828: Compile otherlibs/ C stubs in two version for native and bytecode (Olivier Nicole, review by Sébastien Hinderer and Xavier Leroy)

  • #12265: Stop adding -lexecinfo to cclibs (leftover debugging code from the multicore project). Harden the feature probe for -lm in configure so -lm is only added if strictly necessary. configure.ac now correctly propagates library flags for the Windows ports, allowing Windows OCaml to be configured with ZSTD support. (David Allsopp, review by Sébastien Hinderer)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

Bug fixes:

  • #12062: fix runtime events consumer: when events are dropped they shouldn't be parsed. (Lucas Pluvinage)

  • #12132: Fix overcounting of minor collections in GC stats. (Damien Doligez, review by Gabriel Scherer)

  • #12017: Re-register finaliser only after calling user alarm in Gc.create_alarm (Fabrice Buoro, report by Sam Goldman, review by Guillaume Munch-Maccagnoni)

  • #11887, #11893: Code duplication in pattern-matching compilation (Vincent Laviron, report par Greta Yorsh, review by Luc Maranget and Gabriel Scherer)

  • #10664, #11600: Unsoundness in the typing of polymorphic methods involving polymorphic variants (Jacques Garrigue, report by Mike Shulman, review by Gabriel Scherer)

  • #11302, #11412: ocamlc and ocamlopt should not remove generated files when they are not regular files. (Xavier Leroy, report by Thierry Martinez, review by Anil Madhavapeddy, Nicolás Ojeda Bär, David Allsopp)

  • #10348, #10560, #11561: Expand GADT equations lazily during unification to avoid ambiguity (Jacques Garrigue, review by Leo White)

  • #11436: Fix wrong stack backtrace for out-of-bound exceptions raised by leaf functions. (Tom Kelly and Xavier Leroy, review by Mark Shinwell)

  • #11450, #12018: Fix erroneous functor error messages that were too eager to cast struct end functor arguments as unit modules in F(struct end). (Florian Angetti, review by Gabriel Scherer)

  • #11643: Add missing test declaration to float_compare test, so that it will run. (Stefan Muenzel, review by David Allsopp)

  • #11630: Use correct location when reporting record labels with non-existent paths. (Nicolás Ojeda Bär, report by Jason Gross, review by Gabriel Scherer)

  • #11727: Ensure push_defaults can push past module patterns, fixing an currying optimisation accidentally disabled by #10340. (Stephen Dolan, review by Gabriel Scherer)

  • #11771: Use a more relaxed mode for unification in Ctype.subst (Leo White, review by Jacques Garrigue and Gabriel Scherer)

  • #11803, #11808: on x86, the destination of an integer comparison must be a register, it cannot be a stack slot. (Vincent Laviron, review by Xavier Leroy, report by Emilio Jesús Gallego Arias)

  • #11809: Protect Parmatch.pats_of_type from missing cmis (Jacques Garrigue, review by Stephen Dolan and Gabriel Scherer)

  • #11824: Fix a crash when calling ocamlrun -b (Florian Angeletti, review by Sébastien Hinderer)

  • #11815: Marshalling continuations raises invalid argument exception. (Jérôme Vouillon, review by Nicolás Ojeda Bär, Stephen Dolan and Hugo Heuzard)

  • #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). Reserve the shadow store for the ABI in the c_stack_link struct instead of explictly when calling C functions. This simultaneously reduces the number of stack pointer manipulations and also fixes a bug when calling noalloc functions where the shadow store was not being reserved. (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and KC Sivaramakrishnan)

  • #11850: When stopping before the emit phase (using -stop-after), an empty temporary assembly file is no longer left in the file system. (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy)

  • #11866: Fix the result of caml_read_directory() on non-existent paths. (Andrei Paskevich and Charlène Gros, review by David Allsopp and Nicolás Ojeda Bär)

  • #11879: Bugfix for Ctype.nondep_type (Stephen Dolan, review by Gabriel Scherer)

  • #12004: Don't ignore function attributes on lambdas with locally abstract types. (Chris Casinghino, review by Gabriel Scherer)

  • #12037: Fix some data races by using volatile when necessary (Fabrice Buoro and Olivier Nicole, review by Guillaume Munch-Maccagnoni, Gabriel Scherer and Luc Maranget)

  • #12046: Flush stderr when tracing the parser (Hugo Heuzard, review by David Allsopp and Nicolás Ojeda Bär)

  • #12061, #12063: don't add inconsistent equalities when computing high-level error messages for functor applications and inclusions. (Florian Angeletti, review by Gabriel Scherer)

  • #12075: auto-detect whether ar support @FILE arguments at configure-time to avoid using this feature with toolchains that do not support it (eg FreeBSD/Darwin). (Nicolás Ojeda Bär, review by Xavier Leroy, David Allsop, Javier Chávarri, Anil Madhavapeddy)

  • #12103, 12104: fix a concurrency memory-safety bug in Buffer (Gabriel Scherer, review by Florian Angeletti, report by Samuel Hym)

  • #12112: Fix caml_callback{2,3}_exn when used with effect handlers. (Lucas Pluvinage, review by Gabriel Scherer, David Allsopp and Xavier Leroy)

  • #12134: Use ghost location for nodes created when handling defaults in optional arguments. (Paul-Elliot Anglès d'Auriac, review by Gabriel Scherer)

  • #12153: Fix segfault in bytecode programs involving recursive value definitions of values of size 0 (Vincent Laviron, Xavier Leroy, Gabriel Scherer, review by Xavier Leroy, report by Nick Roberts)

  • #12162: Fix miscompilation on amd64 backends involving integer overflows (Vincent Laviron and Greta Yorsh, review by Stefan Muenzel)

  • #12170: fix pthread_geaffinity_np configure check for android (David Allsopp, review by Sébastien Hinderer)

  • #12178: Fix runtime events consumer poll function returning an invalid value instead of an OCaml integer value. (Lucas Pluvinage)

  • #12252: Fix shared library build error on RISC-V. (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy)

  • #12255, #12256: Handle large signal numbers correctly (Nick Barnes, review by David Allsopp).

  • #12277: ARM64, fix a potential assembler error for very large functions by emitting stack reallocation code before the body of the function. (Xavier Leroy, review by KC Sivaramakrishnan)

  • #12253, #12342: Fix infinite loop in signal handling. (Guillaume Munch-Maccagnoni, report by Thomas Leonard, review by KC Sivaramakrishnan and Sadiq Jaffer)

  • #12445: missing GC root registrations in runtime/io.c (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop)

  • #12481, #12505: Fix incorrect initialization of array expressions [|e1;...;eN|] when N is large enough to require major heap allocation. (Xavier Leroy, report by Andrey Popp, analysis by KC Sivaramakrishnan and Vincent Laviron, review by Gabriel Scherer)

  • #11150, #11207, #11936: Avoid recomputation in Typedecl.check_wellfounded (Jacques Garrigue, report by Boris Yakobowski, review by Gabriel Scherer)

  • #11186, #11188: Fix composition of coercions with aliases (Vincent Laviron, report and review by Leo White)

  • #12486: Fix delivery of unhandled effect exceptions on s390x (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier Leroy)

Since last week, there were two significant bugs fixed in the OCaml 5.1.0 runtime (one overflow bug and a stack corruption bug in the s390x port). Since those bug fixes are as small as they are subtle, they were deemed worthy of a release of a third release candidate for OCaml 5.1.0.

If there are no more surprises this week, the release of OCaml 5.1.0 shall happen next week.

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

The full changelog for OCaml 5.1.0 is available on GitHub

A short summary of the two fixed bugs in this release candidate is also available below.


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.1.0~rc3

The source code for the release candidate is also directly available on:

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

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

See full changelog

Last Second Bug Fixes

  • #11284, +#12525: Use compression of entries scheme when pruning mark stack. Can decrease memory usage for some workloads, otherwise should be unobservable. (Tom Kelly, review by Sabine Schmaltz, Sadiq Jaffer, and Damien Doligez)

  • #12486: Fix delivery of unhandled effect exceptions on s390x (Miod Vallat, report by Jan Midtgaard, review by Vincent Laviron and Xavier Leroy)

In the last two weeks, two significant bugs have been discovered in the release candidate for OCaml 5.1.0 (one affecting the type system, another in the runtime).

Those bugs are now fixed and we are publishing a second release candidate to check that everything is in order before the release in the upcoming week.

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

The full changelog for OCaml 5.1.0 is available on GitHub. A short summary of the two fixed bugs in this release candidate is also available below.


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.1.0~rc2

The source code for the release candidate is also directly available on:

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

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

See full changelog

Last Minute Bug Fixes

Type System:

  • (breaking change) #6941, #11187, +#12483: prohibit using classes through recursive modules inheriting or including a class belonging to a mutually-recursive module would previous behave incorrectly, and now results in a clean error. (Leo White, review by Gabriel Scherer and Florian Angeletti)

Runtime

  • #12481, #12505: Fix incorrect initialization of array expressions [|e1;...;eN|] when N is large enough to require major heap allocation. (Xavier Leroy, report by Andrey Popp, analysis by KC Sivaramakrishnan and Vincent Laviron, review by Gabriel Scherer)

We're thrilled to announce the release of Merlin 4.10, which comes with many bug fixes and improvements.

One of the standout features of this release is the significantly enhanced support for binding operators like let+ and and+. You'll find that the results from type-enclosing on expressions that contain let bindings are now more precise.

See full changelog
  • merlin binary
    • Constrain socket path buffer size to avoid build warnings (#1631)
    • Handle concurrent server start (#1622)
    • Omit module prefixes for constructors and record fields in the construct command (#1618). Prefixes are still produced when warning 42 (disambiguated name) is active.
    • Correctly invalidate PPX cache when pipeline ran partially (#1650, fixes #1647)
    • Prevent short-path from looping in some cases related to recursive type definitions (#1645)
    • Support parsing negative numbers in sexps (#1655)
    • Fix construct not working with inline records (#1658)
    • Improve behavior of type-enclosing on let/and operators (#1653)
    • Fix occurrences of extension constructors (#1662)
    • Improve node selection when ghosts are present (#1664, fixes #1660)
  • editor modes
    • emacs: call merlin-client-logger with "interrupted" if the merlin binary itself is interrupted, not just the parsing of the result (#1626).
    • emacs: merlin-construct, with a prefix argument, now includes local values in the completion options. Alternatively, this behavior can be enabled permanently by customizing merlin-construct-with-local-values (#1644)
    • emacs: add support for opam-switch-mode (#1654, fixes #1591). See https://github.com/ProofGeneral/opam-switch-mode

Odoc 2.2.1

As OCaml 5.1 is on the horizon, we're excited to announce the release of odoc 2.2.1. This latest version brings compatibility with the upcoming OCaml 5.1 release.

See full changelog

Additions

  • OCaml 5.1.0 compatibility (@Octachron, #956)

The release of OCaml 5.1.0 is imminent. As a final step, we are publishing a release candidate to check that everything is in order before the release in the upcoming week(s).

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

Compared to the beta release, this release contains one safe runtime fix and two configuration tweaks.

The full change log for OCaml 5.1.0 is available on GitHub A short summary of the changes since the beta 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 and later:

opam update
opam switch create 5.1.0~rc1

The source code for the release candidate is also directly available on:

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

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

See full changelog

Changes Since the Beta

Bug Fix

  • #12445: missing GC root registrations in runtime/io.c (Gabriel Scherer, review by Xavier Leroy and Jeremy Yallop)

Configuration Fix (openBSD)

  • #12372: Pass option -no-execute-only to the linker for OpenBSD >= 7.3 so that code sections remain readable, as needed for closure marshaling. (Xavier Leroy and Anil Madhavapeddy, review by Anil Madhavapeddy and Sébastien Hinderer)

Tool Fix (ocamlmktop)

  • #11745, #12358: Debugger and toplevels: embed printer types rather than reading their representations from topdirs.cmi at runtime. This change also removes the ocamlmktop initialisation module introduced in #11382 which was no longer useful. This change breaks toplevel scripts relying on the visibility of Topdirs in the initial toplevel environment without loading topfind. Since the opam default .ocamlinit file loads topfind, it is expected that only scripts run with ocaml -noinit are affected. For those scripts, accessing Topdirs now requires the compiler-libs directory to be added to the toplevel search path with
      #directory "+compiler-libs";;
    

as was already the case for the other modules in the toplevel interface library. (Sébastien Hinderer, review by Florian Angeletti, Nicolás Ojeda Bär, and Gabriel Scherer)

Documentation Changes

  • #12201: in the tutorial on modules, replace priority queue example by a simpler example based on FIFO queues. (Xavier Leroy, review by Anil Madhavapeddy and Nicolás Ojeda Bär).

  • #12352: Fix a typo in the documentation of Arg.write_arg (Christophe Raffalli, review by Florian Angeletti)

Dune 3.9.3

The fix to sendfile in 3.9.2 was not quite enough so here is the last part of the fix. It brings compatibility with filesystems where sendfile is not available, in particular when ecryptfs is used.

See full changelog

Fixes

  • Fix flushing when using sendfile fallback (#8288, fixes #8284, @alan-j-hu)

Dune 3.10.0

We're happy to announce the release of Dune 3.10.0. It comes with some internal fixes as well as some interesting features:

  • some changes in dune describe that will allow a better implementation of opam-dune-lint to check the consistency between library and package dependencies
  • more commands made available under dune show for a more consistent command line interface
See full changelog

Added

  • Add dune show rules as alias of the dune rules command. (#8000, @Alizter)

  • Add dune show installed-libraries as an alias of the dune installed-libraries command. (#8135, @Alizter)

  • Add dune build --dump-gc-stats FILE argument to dump garbage collection stats to a named file. (#8072, @Alizter)

  • Add dune describe package-entries to print all package entries (#7480, @moyodiallo)

Fixed

  • Fix %{deps} to expand properly in (cat ...) when containing 2 or more items. (#8196, @Alizter)

  • Fix the severity of error messages sent over RPC which was missing. (#8193, @Alizter)

  • Fix bug with ppx and Reason syntax due to missing dependency in sandboxed action (#7932, fixes #7930, @Alizter)

Changed

  • Improve dune describe external-lib-deps by adding the internal dependencies for more information. (#7478, @moyodiallo)

  • Re-enable background file digests on Windows. The files are now open in a way that prevents race condition around deletion. (#8262, fixes #8268, @emillon)

Feedback on this post is welcomed on Discuss!

We are happy to announce the second alpha release of opam 2.2.0. It contains some fixes and a new feature for Windows. You can view the full list in the release note.

This version is an alpha. so we invite users to test it for previously unnoticed bugs to head towards the stable release.

Windows Support

The first alpha came with native Windows compatibility. This second alpha comes with a simpler initialisation for Windows: we no longer rely on an already present Cygwin UNIX-like environment for Windows as a compatibility layer. During initialisation, opam now proposes to embed its own fully managed Cygwin install.

The main opam-repository Windows compliance is still a work in progress. We recommend using an existing, compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27).

How to Test opam on Windows

This alpha requires a preexisting Cygwin installation for compiling opam.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • If you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory launch make cold
  3. A coffee later, you now have an opam executable!
  4. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install the sunset repository packages. If you find any bugs, please submit an issue. It will help opam-repository maintainers to add Windows repository packages into the main repository.

Hint: if you use the MinGW compiler, don't forget to add to your PATH the path to libc dlls (usually C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin). You can also compile opam with make cold CONFIGURE_ARGS=--with-private-runtime, and if you change opam's location, don't forget to copy Opam.Runtime.amd64 (or Opam.Runtime.i386) with it.

Updates & Fixes

  • opam var now has a more informative error message in case of package variable
  • opam lint: update Error 29 on package variables on filters to check also conflicts: field
  • opam admin lint cleans output when called not from a terminal
  • configure throws an error if no complementary compiler is found on Windows

Try It!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. Either from binaries, run

    bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0~alpha2"
    

    or download manually from the Github "Releases" page to your PATH.

  2. Or from source, manually: see the instructions in the README.

You should then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Dune 3.9.2

This bugfix-only release contains two platform-specific changes: one fixes the Dune cache on Windows, and the other one completes the fix on Linux when sendfile is not available. This makes Dune available where user directories are encrypted using ecryptfs for example.

See full changelog

Fixes

  • Disable background digests on Windows. This prevents an issue where unremovable files would make Dune crash when the shared cache is enabled. (#8243, fixes #8228, @emillon)

  • Fix permission errors when sendfile is not available (#8234, fixes #8210, @emillon)

We are thrilled to announce the release of OCamlFormat 0.26.0!

After almost 5 months of intense development, this release comes with a ton of consistency improvements and bug fixes. In particular, the handling of comments should be largely superior!

Have a look at the full changelog to see the list of improvements, and don't hesitate to share your feedback on this release on OCaml Discuss.

See full changelog

Items marked with an asterisk (*) are changes that are likely to format existing code differently from the previous release when using the default profile.

New features

  • Handle short syntax for generative functor types (#2348, @gpetiot)
  • Improved error reporting for unstable or dropped comments (#2292, @gpetiot)

Removed

  • Remove --numeric feature (#2333, #2357, @gpetiot)

Bug fixes

  • Fix crash caused by let f (type a) :> a M.u = .. (#2399, @Julow)
  • Fix crash caused by module T = (val (x : (module S))) (#2370, @Julow)
  • Fix invalid formatting of then begin end (#2369, @Julow)
  • Protect match after fun _ : _ -> (#2352, @Julow)
  • Fix invalid formatting of (::) (#2347, @Julow)
  • Fix indentation of module-expr extensions (#2323, @gpetiot)
  • * Remove double parentheses around tuples in a match (#2308, @Julow)
  • * Remove extra parentheses around module packs (#2305, @Julow, @gpetiot)
  • Fix indentation of trailing double-semicolons (#2295, @gpetiot)
  • Fix formatting of comments in "disable" chunks (#2279, @gpetiot)
  • Fix non-stabilizing comments attached to private/virtual/mutable keywords (#2272, #2307, @gpetiot, @Julow)

Changes

  • Improve formatting of doc-comments (#2338, #2349, #2376, #2377, #2379, #2378, @Julow) Remove unnecessary escaping and preserve empty lines.
  • * Indent as-patterns that have parentheses (#2359, @Julow)
  • Don't print warnings related to odoc code-blocks when '--quiet' is set (#2336, #2373, @gpetiot, @Julow)
  • * Improve formatting of module arguments (#2322, @Julow)
  • * Don't indent attributes after a let/val/external (#2317, @Julow)
  • Consistent indentation of @@ let+ x = ... (#2315, #2396, @Julow) It was formatted differently than @@ let x = ....
  • * Improve formatting of class expressions and signatures (#2301, #2328, #2387, @gpetiot, @Julow)
  • * Consistent indentation of fun (type a) -> following fun x -> (#2294, @Julow)
  • * Restore short-form formatting of record field aliases (#2282, #2388, @gpetiot, @Julow)
  • * Restore short-form for first-class modules: ((module M) : (module S)) is formatted as (module M : S)) (#2280, #2300, @gpetiot, @Julow)
  • * Improve indentation of ~label:(fun ... (#2271, #2291, #2293, #2298, #2398, @Julow) The fun keyword is docked where possible and the arguments are indented to avoid confusion with the body.
  • JaneStreet profile: treat comments as doc-comments (#2261, #2344, #2354, #2365, #2392, @gpetiot, @Julow)
  • Tweaks the JaneStreet profile to be more consistent with ocp-indent (#2214, #2281, #2284, #2289, #2299, #2302, #2309, #2310, #2311, #2313, #2316, #2362, #2363, @gpetiot, @Julow)

Utop 2.13.1

The release of UTop 2.13.0 introduced a regression on Windows. We're releasing UTop 2.13.1 with a patch, and made UTop 2.13.0 unavailable on Windows.

See full changelog
  • Fix unavailable expunge on Windows (#447, @jonahbeckford)

Dune 3.9.1

In Dune 3.9.0, we added a feature that offloads some computations to background threads. Unfortunately, this has a bad interaction on macOS, where we fork processes to implement the RPC server and watch mode.

We marked Dune 3.9.0 unavailable on macOS, and released 3.9.1 with some mitigations: we don't offload these computations on macOS, and we only fork when necessary.

The plan for the next release is to stop forking processes on macOS.

See full changelog

Fixes

  • Disable background operations and threaded console on macOS and other Unixes where we rely on fork. (#8100, #8121, fixes #8083, @rgrinberg, @emillon)

  • Initialize async I/O thread lazily. (#8122, @emillon)

Utop 2.13.0

We're releasing version 2.13.0 of UTop! This version comes with a couple of bug fixes.

It also bumps the minimal required version of OCaml to 4.11.0 and removes deprecated values from the API.

See full changelog
  • Fix behavior of utop -stdin (#434, fixes #433, @tuohy)

  • Handle bounds with Zed.next_error (#442, @tmattio)

  • Load files from XDG directories (the legacy paths still work). (#431, @Skyb0rg007)

  • Remove deprecated values prompt_continue, prompt_comment, smart_accept, new_prompt_hooks, at_new_prompt (#427, @emillon)

  • Require OCaml 4.11.0 or newer. (#444, @emillon)

Feedback on this post is welcomed on Discuss!

We are happy to announce the alpha release of opam 2.2.0. It contains numerous fixes, enhancements, and updates; including much-improved Windows support, addressing one of the most important pain points identified by the OCaml community. You can view the full list of changes in the release note.

This alpha release is a significant milestone, brought together by Raja Boujbel after years of work from the opam dev team (Raja Boujbel, David Allsopp, Kate Deplaix, Louis Gesbert, in a united OCamlPro/Tarides collaboration) with the help of many community contributors. We also thank Jane Street for their continued sponsorship.

This version is an alpha, so we invite users to test it to spot previously unnoticed bugs and work towards a stable release.

Windows Support

Opam 2.2 comes with native Windows compatibility. You can now use opam from your preferred Windows terminal! We rely on the Cygwin UNIX-like environment for Windows as a compatibility layer, but it is possible for a package to generate native executables.

The main opam repository is not Windows compatible at the moment, but existing work on a compatible repository (originally from @fdopen) and 32/64 bit mingw-w64 packages (by @dra27) is in the process of being merged. Before the final release, we expect it to be possible to run opam init and use the main opam-repository for Windows.

How to Test opam on Windows

This alpha requires a preexisting Cygwin installation. Support for full management of a local Cygwin environment inside of opam (so that it's as transparent as possible) is queued already and should be available in 2.2.0~alpha2 as the default option.

  1. Check that you have all dependencies installed:
  • autoconf, make, patch, curl
  • MinGW compilers: mingw64-x86_64-gcc-g++, mingw64-i686-gcc-g++
  • Or if you want to use the MSVC port of OCaml, you'll need to install Visual Studio or Visual Studio Build Tools
  1. Download & extract the opam archive
  2. In the directory launch make cold
  3. A coffee later, you now have an opam executable!
  4. Start your preferred Windows terminal (cmd or PowerShell), and initialise opam with the Windows sunset repository:
  • opam init https://github.com/ocaml-opam/opam-repository-mingw

From here, you can try to install sunset repository packages. If any bug is found, please submit an issue. It will help opam repository maintainers to add Windows repository packages into the main repository.

Hint: if you use the MinGW compiler, don't forget to add to your PATH the path to libc dlls (usually C:\cygwin64\usr\x86_64-w64-mingw32\sys-root\mingw\bin). Or compile opam with make cold CONFIGURE_ARGS=--with-private-runtime, and if you change opam location, don't forget to copy Opam.Runtime.amd64 (or Opam.Runtime.i386) with it.

Recursive Pin

When installing or pinning a package using opam install or opam pin, opam normally only looks for opam files at the root of the installed package. With recursive pinning, you can now instruct opam to also look for .opam files in subdirectories, while maintaining the correct relationship between the .opam files and the package root for versioning and build purposes.

Recursive pinning is used with the following options to opam pin and opam install:

  • With --recursive, opam will look for .opam files recursively in all subdirectories.
  • With --subpath <path>, opam will only look for .opam files in the subdirectory <path>.

The two options can be combined: for instance, if your opam packages are stored as a deep hierarchy in the mylib subdirectory of your project, give opam pin . --recursive --subpath mylib a try!

You can use these options with opam pin, opam install, and opam remove.

$ tree .
.
├── ba
│   └── z
│       └── z.opam
├── bar
│   └── bar.opam
└── foo.opam

$ opam pin . --subpath ba/z --no-action
Package z does not exist, create as a NEW package? [y/n] y
z is now subpath-pinned to directory /ba/z in git+file:///tmp/recpin#master (version 0.1)

$ opam pin --recursive . --no-action
This will pin the following packages: foo, z, bar. Continue? [y/n] y
foo is now pinned to git+file:///tmp/recpin#master (version 0.1)
Package z does not exist, create as a NEW package? [y/n] y
z is now subpath-pinned to directory /ba/z in git+file:///tmp/recpin#master (version 0.1)
Package bar does not exist, create as a NEW package? [y/n] y
bar is now subpath-pinned to directory /bar in file:///tmp/recpin (version 0.1)

$ opam pin
bar.0.1  (uninstalled)  rsync  directory /bar in file:///tmp/recpin
foo.0.1  (uninstalled)  git    git+file:///tmp/recpin#master
z.0.1    (uninstalled)  git    directory /ba/z in git+file:///tmp/recpin#master

$ opam pin . --recursive --subpath ba/ --no-action
Package z does not exist, create as a NEW package? [y/n] y
z is now subpath-pinned to directory /ba/z in git+file:///tmp/recpin#master (version 0.1)

Tree View

opam tree shows packages and their dependencies with a tree view. It is very helpful to determine which packages bring which dependencies in your installed switch.

$ opam tree cppo
cppo.1.6.9
├── base-unix.base
├── dune.3.8.2 (>= 1.10)
│   ├── base-threads.base
│   ├── base-unix.base [*]
│   └── ocaml.4.14.1 (>= 4.08)
│       ├── ocaml-base-compiler.4.14.1 (>= 4.14.1~ & < 4.14.2~)
│       └── ocaml-config.2 (>= 2)
│           └── ocaml-base-compiler.4.14.1 (>= 4.12.0~) [*]
└── ocaml.4.14.1 (>= 4.02.3) [*]

It can also display a reverse-dependency tree (through opam why, which is an alias to opam tree --rev-deps). This is useful to examine how dependency versions get constrained.

$ opam why cmdliner
cmdliner.1.2.0
├── (>= 1.1.0) b0.0.0.5
│   └── (= 0.0.5) odig.0.0.9
├── (>= 1.1.0) ocp-browser.1.3.4
├── (>= 1.0.0) ocp-indent.1.8.1
│   └── (>= 1.4.2) ocp-index.1.3.4
│       └── (= version) ocp-browser.1.3.4 [*]
├── (>= 1.1.0) ocp-index.1.3.4 [*]
├── (>= 1.1.0) odig.0.0.9 [*]
├── (>= 1.0.0) odoc.2.2.0
│   └── (>= 2.0.0) odig.0.0.9 [*]
├── (>= 1.1.0) opam-client.2.2.0~alpha
│   ├── (= version) opam.2.2.0~alpha
│   └── (= version) opam-devel.2.2.0~alpha
├── (>= 1.1.0) opam-devel.2.2.0~alpha [*]
├── (>= 0.9.8) opam-installer.2.2.0~alpha
└── user-setup.0.7

Special thanks to @cannorin for contributing this feature.

Recommended Development Tools

There is now a way for a project maintainer to share their project development tools: the with-dev-setup dependency flag. It is used in the same way as with-doc and with-test: by adding a {with-dev-setup} filter after a dependency. It will be ignored when installing normally, but it's pulled in when the package is explicitely installed with the --with-dev-setup flag specified on the command line. The variable is also resolved in the post-messages: field to allow maintainers to share more informations about that setup.

This is typically useful for tools that are required for bootstrapping or regenerating artifacts.

For example

opam-version: "2.0"
depends: [
  "ocaml"
  "dune"
  "ocp-indent" {with-dev-setup}
]
build: [make]
install: [make "install"]
post-messages:
[ "Thanks for installing the package"
  "and its tool dependencies too, it will help for your futur PRs" {with-dev-setup} ]

Software Heritage Binding

Software Heritage is a project that aims to archive all software source code in existence. This is done by collecting source code with a loader that uploads software source code to the Software Heritage distributed infrastructure. From there, any project/version is available via the search webpage and via a unique identifier called the SWHID. Some OCaml source code is already archived, and the main opam and Coq repository packages are continuously uploaded.

Opam now integrates a fallback to Software Heritage archive retrieval, based on SWHID. If an SWHID URL is present in an opam file, the fallback can be activated.

To keep backwards compatibility of opam files, we added a specific Software Heritage URL syntax to the url.mirrors: field, which is used to specify mirrors of the main URL. Opam 2.2.+ understands this specific syntax as a Software Heritage fallback URL: https://swhid.opam.ocaml.org/<SWHID>.

url {
  src: "https://faili.ng/url.tar.gz"
  checksum: "sha512=e2146c1d7f53679fd22df66c9061b5ae4f8505b749513eedc67f3c304f297d92e54f5028f40fb5412d32c7d7db92592eacb183128d2b6b81d10ea716b7496eba"
  mirrors: [
    "https//failli.ng/mirror.tar.gz"
    "https://swhid.opam.ocaml.org/swh:1:dir:9f2be900491e1dabfc027848204ae01aa88fc71d"
  ]
}

To add a Software Heritage fallback URL to your package, use the swhid library. Specifically the Compute.directory_identifier_deep function:

  1. Download opam package archive
  2. Extract the archive
  3. Compute SWHID with Compute.directory_identifier_deep. You can use this oneliner in the directory:
ocaml -e '#use "topfind";; #require "digestif.ocaml";; #require "swhid";; Swhid_core.Object.pp Format.std_formatter (Result.get_ok (Swhid.Compute.directory_identifier_deep "."))'

Special thanks to @zapashcanon for collaborating on this feature.

Formula (Experimental)

It is now possible to leverage the full expressivity of package dependency formulas from the command line during switch creation and package operations.

It is possible to create a switch using a formula. For example, with ocaml-variant or ocaml-system, excluding ocaml-base-compiler:

opam switch create ocaml --formula '"ocaml-variants" {>= "4.14.1"} | "ocaml-system"'

This syntax is brought to install commands. For example, while installing a package, let's say genet, you can specify that you want to install either conf-mariadb & mariadb or conf-postgresql:

opam install genet --formula '["mysql" ("conf-mariadb" & "mariadb" | "conf-postgresql")]'

New Options

Here are several of new options (possibly scripts breaking changes are marked with ✘):

  • opam pin --current to fix a package to its current state (disabling pending reinstallations or removals from the repository). The installed package will be pinned with the opam file that is stored in opam internal state, the one that is currently installed.

  • opam pin remove --all to remove all the pinned packages from a switch.

  • opam pin remove pkg.version now removes the pins on pinned pkg.version.

  • opam exec --no-switch to remove opam environment from launched command.

$ export FOOVAR=env
$ opam show foo --field setenv
FOOVAR = "package"
$ opam exec  -- env | grep "OPAM_SWITCH\|FOO"
FOOVAR=package
OPAM_SWITCH_PREFIX=~/.opam/env
$ opam exec --no-switch -- env | grep "OPAM_SWITCH\|FOO"
FOOVAR=env
  • opam source --no-switch to allow downloading package sources without having an installed switch (instead of failing).

  • opam clean --untracked to remove untracked files interactively remaining from previous packages removal.

  • opam switch -, inspired from git switch -, that goes back to the previously selected global switch.

  • opam admin add-constraint <cst> --packages pkg1,pkg2,pkg3 to select a subset of packages to apply constraints.

  • ✘ Change --base into --invariant. opam switch compiler column now contains installed packages that verifies invariant formula, and empty synopsis shows switch invariant.

$ opam switch create inv --formula '["ocaml" {>= "4.14.1"} "dune"]'
$ opam switch invariant
["ocaml" {>= "4.14.1"} "dune"]
$ opam list --invariant
# Packages matching: invariant
# Name # Installed # Synopsis
dune   3.8.2       Fast, portable, and opinionated build system
ocaml  5.0.0       The OCaml compiler (virtual package)
$ opam switch list
#  switch   compiler                                            description
→  inv      ocaml-base-compiler.5.0.0,ocaml-options-vanilla.1   ocaml >= 4.14.1 & dune

Try It!

In case you plan a possible rollback, you may want to first backup your ~/.opam directory.

The upgrade instructions are unchanged:

  1. From binaries: run
bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0~alpha"

Or download manually from the Github "Releases" page to your PATH.

  1. From source, manually: see the instructions in the README.

Then run:

opam init --reinit -ni

Please report any issues to the bug-tracker.

Thanks for trying this new release out, and we're hoping you will enjoy the new features!

After two alpha releases, the release of OCaml 5.1.0 is drawing near. We have thus released a first beta version of OCaml 5.1.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions). Compared to the last alpha release, this beta contains two subtle internal runtime fixes and one Windows fix. Overall, the opam ecosystem looks in a good shape for the first beta release.

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

Nearly all core development tools support OCaml 5.1.0, and you can follow the last remaining wrinkles on the opam readiness for 5.1.0 meta-issue.

Currently, the release is planned for the end of July or the beginning of August.

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


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.1.0~beta1

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

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

See full changelog

Runtime System Bugfix

  • #12037: Fix some data races by using volatile when necessary (Fabrice Buoro and Olivier Nicole, review by Guillaume Munch-Maccagnoni, Gabriel Scherer and Luc Maranget)

  • #12253, #12342: Fix infinite loop in signal handling. (Guillaume Munch-Maccagnoni, report by Thomas Leonard, review by KC Sivaramakrishnan and Sadiq Jaffer)

Windows Bugfix

  • #12184, #12320: Sys.rename Windows fixes on directory corner cases. (Jan Midtgaard, review by Anil Madhavapeddy)

Dune 3.9.0

The Dune team is thrilled to announce the release of Dune 3.9.0. This version ships with a host of new features and improvements, including:

  • New dune show Command: This command enables you to display various pieces of information. For instance, you can use dune show pp to display the preprocessed output of a file or dune show aliases [DIR] to list the aliases available in DIR. Read more about the command on its manpage using dune show --help.
  • Improved Dialect Support: We have rolled out several fixes related to dialect support. These changes make it easier to work with Dream's .eml files.
  • Introduction of (build_if) Toggle in (test) Stanza: This new field facilitates the packaging of non-portable tests and benchmarks. If you have tests that don't build on a specific platform, you can now tell Dune not to build them on other Platforms with the build_if field.

Enjoy the new features and improvements incorporated into this version!

See full changelog

Added

  • Include the time it takes to read/write state files when --trace-file is enabled (#7960, @rgrinberg)

  • Include source tree scans in the traces produced by --trace-file (#7937, @rgrinberg)

  • Add --all option to dune rpc status to show all Dune RPC servers running. (#8011, fix #7902, @Alizter)

  • Add additional metadata to the traces provided by --trace-file whenever --trace-extended is passed (#7778, @rleshchinskiy)

  • $ dune describe is now a command group, so arguments to subcommands must be passed after subcommand itself. (#7919, @Alizter)

  • Add dune show command group which is an alias of dune describe. (#7946, @Alizter)

  • Add dune show env command and make dune printenv an alias of it. (#7985, @Alizter)

  • Add commands dune show targets and dune show aliases that display all the available targets and aliases in a given directory respectively. (#7770, grants #265, @Alizter)

  • Extensions used in (dialect) can contain periods (e.g., cppo.ml). (#7782, fixes #7777, @nojb)

  • The interface and implementation fields of a (dialect) are now optional (#7757, @gpetiot)

  • Add (build_if) to the (test) stanza. When it evaluates to false, the executable is not built. (#7899, fixes #6938, @emillon)

  • Allow (include_subdirs qualified) to be used when libraries define a (modules ...) field (#7797, fixes #7597, @anmonteiro)

  • Allow multiple globs in library's (stdlib (internal_modules ..)) (@anmonteiro, #7878)

Changed

  • Do not rerun OCaml syntax files on every iteration of the watch mode. This is too memory consuming. (#7894, fix #6900, @rgrinberg)

  • Attach melange rules to the default alias (#7926, @haochenx)

  • Compute digests and manage sandboxes in background threads (#7947, @rgrinberg)

Fixed

  • Validate file extension for $ dune ocaml top-module. (#8005, fixes #8004, @3Rafal)

  • Cinaps: The promotion rules for cinaps would only offer one file at a time no matter how many promotions were available. Now we offer all the promotions at once (#7901, @rgrinberg)

  • Add necessary parentheses in generated opam constraints (#7682, fixes #3431, @Lucccyo)

Removed

  • Remove some compatibility code for old version of dune that generated .merlin files. Now dune will never remove .merlin files automatically (#7562)

  • In opam constraints, reject (and) and (or) with no arguments at parse time (#7730, @emillon)

The OCaml infrastructure team is going to move to Debian 12 as the main distribution from Debian 11. We will continue to provide Debian 11 and 10 images while they are supported, dropping Debian 10 when it reaches end of life in 2024-06-30. In addition to these changes we are deprecating Ubuntu 18.04, Alpine 3.16/17, OL7, OpenSuse 15.2 distributions as the have reached end of life. We strongly recommend updating to a newer version if you are still using them.

Please get in touch on https://github.com/ocaml/infrastructure/issues if you have questions or requests for additional support.

See full changelog
  • OCaml Debian images upgraded to Debian 12 (ocaml-dockerfile#172, @MisterDA)
  • Deprecation of Ubuntu 18.04, Alpine 3.16 and 3.17, OracleLinux 7, OpenSUSE 15.2 images (ocaml-dockerfile#176, @avsm)
  • Deprecate Ubuntu 18.04, Alpine 3.16/17, OL7, OpenSuse 15.2 for OCaml-CI (ocaml-ci#832, @tmcgilchrist)
  • Deprecate Ubuntu 18.04, Alpine 3.16/17, OL7, OpenSuse 15.2 for opam-repo-ci (opam-repo-ci#226, @tmcgilchrist)
  • Deprecate Ubuntu 18.04, Alpine 3.16/17, OL7, OpenSuse 15.2 for docker-base-images (docker-base-images#237, @tmcgilchrist)

Dune 3.8.3

This point release fixes two important issues on Windows and Linux.

See full changelog
  • Fix deadlock on Windows (dune#8044, @nojb)
  • When using sendfile to copy files on Linux, fall back to the portable version if it fails at runtime for some reason (NFS, etc). (dune#8049, fixes dune#8041, @emillon)

We're excited to announce the release of Dune-release 2.0.0!

This release brings support for putting your .opam files in a opam/ directory. If your project contains dozens of packages, you'll be able to generate them into the opam/ folder starting with Dune 3.8 using (opam_file_location inside_opam_directory) in your dune-project.

Another notable change is the removal of delegates. Users of dune-release who want to publish their packages to another platform than GitHub can now use the dune-release delegate-info and use the output to build their own publication workflows.

See full changelog

Added

  • Adopt the OCaml Code of Conduct (#473, @rikusilvola)
  • Added support for projects that have their OPAM files in the opam/ subdirectory. (#466, @Leonidas-from-XIV)

Changed

  • Running dune-release check now attempts to discover and parse the change log, and a new flag --skip-change-log disables this behaviour. (#458, @gridbugs)
  • List the main package and amount of subpackages when creating the PR to avoid very long package lists in PRs (#465, @emillon)

Fixed

  • Avoid collision between branch and tag name. Tag detection got confused when branch was named the same as tag. Now it searches only for tag refs, instead of all refs. (#452, @3Rafal)
  • Fix project name detection from dune-project. The parser could get confused when opam file generation is used. Now it only considers the first (name X) in the file. (#445, @emillon)

Removed

  • Remove support for delegates. Previous users of this feature should now use dune-release delegate-info and wrap dune-release calls in a script. See #188 for details. (#428, @NathanReb)
  • Removed support for the OPAM 1.2.2 client. This means dune-release expects the opam binary to be version 2.0 at least. (#406, #411, @Leonidas-from-XIV)

We've released OCaml LSP 1.16.2 with a fix that was introduced in 1.16.1 that prevented users from using preprocessor such as CPPO.

See full changelog

Fixes

  • Fix file permissions used when specifying output files of pp and ppx. (ocaml-lsp#1153)

We're thrilled to announce the release of OCaml LSP 1.16.1! 🎉

This release comes with new "Extract local" and "Extract function" code actions to easily refactor your code.

We've also disabled code lenses by default following user feedback. You can follow the discussion on GitHub.

This release is also the first OCaml LSP release to use upstream Merlin. Among other things, this means that it is compatible with all the OCaml versions supported by Merlin: currently OCaml 4.14 and 5.0.0.

We're also releasing numerous bug fixes, including:

  • A fix to the integration with Dune RPC on Windows, which, alongside Dune 3.9.0, makes OCaml LSP report Dune errors to the editors with Dune watch mode enabled.
  • Minor improvements to the Odoc <-> Markdown conversion to return better function documentation on the editor.

And much more! Read the full changelog for a complete list of improvements and bug fixes.

See full changelog

Features

  • Add "Remove type annotation" code action. (#1039)
  • Support settings through didChangeConfiguration notification (#1103)
  • Add "Extract local" and "Extract function" code actions. (#870)
  • Depend directly on merlin-lib 4.9 (#1070)

Fixes

  • Support building with OCaml 5.0 and 5.1 (#1150)

  • Disable code lens by default. The support can be re-enabled by explicitly setting it in the configuration. (#1134)

  • Fix initilization of ocamlformat-rpc in some edge cases when ocamlformat is initialized concurrently (#1132)

  • Kill unnecessary $ dune ocaml-merlin with SIGTERM rather than SIGKILL (#1124)

  • Refactor comment parsing to use odoc-parser and cmarkit instead of octavius and omd (#1088)

    This allows users who migrated to omd 2.X to install ocaml-lsp-server in the same opam switch.

    We also slightly improved markdown generation support and fixed a couple in the generation of inline heading and module types.

  • Allow opening documents that were already open. This is a workaround for neovim's lsp client (#1067)

  • Disable type annotation for functions (#1054)

  • Respect codeActionLiteralSupport capability (#1046)

  • Fix a document syncing issue when utf-16 is the position encoding (#1004)

  • Disable "Type-annotate" action for code that is already annotated. (#1037, fixes #1036)

  • Fix semantic highlighting of long identifiers when using preprocessors (#1049, fixes #1034)

  • Fix the type of DocumentSelector in cram document registration (#1068)

  • Accept the --clientProcessId command line argument. (#1074)

  • Accept --port as a synonym for --socket. (#1075)

  • Fix connecting to dune rpc on Windows. (#1080)

Ppxlib 0.30.0

We're excited to announce the release of Ppxlib 0.30.0! It comes with support for OCaml 5.1, various enhancements, and bug fixes.

For PPX writing, Ast_pattern now offers additional utility functions, while metaquot benefits from improved error reporting.

PPX usage sees better compatibility with OCaml trunk, thanks to the Driver's improved Parsetree version recognition. This allows for compatibility with both trunk and stable OCaml versions concurrently.

Finally, this release enhances Ppxlib's compatibility with ReScript, introducing "ns" and "res" as reserved namespaces.

See full changelog

Dune 3.8.2

We've released Dune 3.8.2 with a few bug fixes.

See full changelog
  • Switch back to threaded console for all systems; fix unresponsive console on Windows (dune#7906, @nojb)
  • Respect -p / --only-packages for melange.emit artifacts (dune#7849, @anmonteiro)
  • Fix scanning of Coq installed files (@ejgallego, reported by @palmskog, dune#7895 , fixes dune#7893)
  • Fix RPC buffer corruption issues due to multi threading. This issue was only reproducible with large RPC payloads (dune#7418)
  • Fix printing errors from excerpts whenever character offsets span multiple lines (dune#7950, fixes dune#7905, @rgrinberg)

The server toxis where Opam-Repo-CI and OCaml-CI were deployed suffered hardware difficulties yesterday, resulting in BTRFS filesystem corruption and memory issues. These issues are tracked on ocaml/infrastructure#51. Services were restored temporarily using a spare spinning disk, but we continued to see ECC memory issues.

All services have now been redeployed on new ARM64 hardware. We retained the databases for Prometheus, OCaml-CI and Opam-Repo-CI, but unfortunately, older job logs have been lost.

The external URLs for these services are unchanged.

Dune 3.8.1

We've just released a patch version of Dune to fix regressions introduced in Dune 3.8.0.

In particular, we've reverted some cross-compilation improvements that caused build failures when using ppx_runtime_libraries and we'll revisit them in a future version of Dune.

See full changelog
  • Fix a crash when using a version of Coq < 8.13 due to the native compiler config variable being missing. We now explicitly default to (mode vo) for these older versions of Coq. (dune#7847, fixes dune#7846, @Alizter)
  • Duplicate installed Coq theories are now allowed with the first appearing in COQPATH being preferred. This is inline with Coq's loadpath semantics. This fixes an issue with install layouts based on COQPATH such as those found in nixpkgs. (dune#7790, @Alizter)
  • Revert dune#7415 and dune#7450 (Resolve ppx_runtime_libraries in the target context when cross compiling) (dune#7887, fixes dune#7875, @emillon)

With the progress of the ongoing stabilisation effort for OCaml 5.1.0, I am happy to announce a second alpha release for OCaml 5.1.0.

This second alpha release contains many noteworthy fixes:

  • a long-awaited GC fix
  • a Windows ABI fix

as announced in the first alpha but also

  • a compiler-libs (parsetree) fix
  • a type system compatibility enhancement change
  • a restored backed for s390x/IBM Z

The full list of changes since the first alpha is available below.

Once most major OCaml tools are updated to the last compiler-libs changes, we will switch to beta releases. Hopefully, this will happen in the upcoming weeks. The progress on stabilising the ecosystem is tracked on the opam readiness for 5.1.0 meta-issue.

Currently, the release is still planned for around July.

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, the updated change log for OCaml 5.1.0 is available on GitHub.


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.1.0~alpha2

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

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

See full changelog

Runtime System

  • #11589, #11903: Modify the GC pacing code to make sure the GC keeps up with allocations in the presence of idle domains. (Damien Doligez and Stephen Dolan, report by Florian Angeletti, review by KC Sivaramakrishnan and Sadiq Jaffer)
  • (breaking change) #11865, #11868, #11876: Clarify that the operations of a custom block must never access the OCaml runtime. The previous documentation only mentioned the main illicit usages. In particular, since OCaml 5.0, it is no longer safe to call caml_remove_global_root or caml_remove_generational_global_root from within the C finalizer of a custom block, or within the finalization function passed to caml_alloc_final. As a workaround, such a finalization operation can be registered with Gc.finalize instead, which guarantees to run the finalizer at a safe point. (Report by Timothy Bourke, discussion by Yotam Barnoy, Timothy Bourke, Sadiq Jaffer, Xavier Leroy, Guillaume Munch-Maccagnoni, and Gabriel Scherer)
  • #11827, +#12249: Restore prefetching for GC marking (Fabrice Buoro and Stephen Dolan, review by Gabriel Scherer and Sadiq Jaffer)
  • #12131: Simplify implementation of weak hash sets, fixing a performance regression. (Nick Barnes, review by François Bobot, Alain Frisch and Damien Doligez).

  • #12231: Support MinGW-w64 11.0 winpthreads library, where the macro to set up to get flexdll working changed (David Allsopp and Samuel Hym, light review by Xavier Leroy)

Type System

  • (breaking change) #12189, #12211: anonymous row variables in explicitly polymorphic type annotation, e.g. 'a. [< X of 'a ] -> 'a, are now implicitly universally quantified (in other words, the example above is now read as 'a 'r. ([< X of 'a ] as 'r) -> 'a). (Florian Angeletti and Gabriel Scherer, review by Jacques Garrigue)

Code Generation And Optimizations

  • #11712, #12258, #12261: s390x / IBM Z multicore support: OCaml & C stack separation; dynamic stack size checks; fiber and effects support. (Aleksei Nikiforov, with help from Vincent Laviron and Xavier Leroy, additional suggestions by Luc Maranget, review by the same and KC Sivaramakrishnan)

Internal/compiler-libs Changes

  • #12119, +#12188, +#12191: mirror type constraints on value binding in the parsetree: the constraint typ in let pat : typ = exp is now directly stored in the value binding node in the parsetree. (Florian Angeletti, review by Richard Eisenberg)

Bug Fixes

  • #11846: Mark rbx as destroyed at C call for Win64 (mingw-w64 and Cygwin64). Reserve the shadow store for the ABI in the c_stack_link struct instead of explictly when calling C functions. This simultaneously reduces the number of stack pointer manipulations and also fixes a bug when calling noalloc functions where the shadow store was not being reserved. (David Allsopp, report by Vesa Karvonen, review by Xavier Leroy and KC Sivaramakrishnan)

  • #12170: fix pthread_geaffinity_np configure check for android (David Allsopp, review by Sébastien Hinderer)

  • #12252: Fix shared library build error on RISC-V. (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy)

  • #12255, #12256: Handle large signal numbers correctly (Nick Barnes, review by David Allsopp).

  • #12277: ARM64, fix a potential assembler error for very large functions by emitting stack reallocation code before the body of the function. (Xavier Leroy, review by KC Sivaramakrishnan)

opam 2.1.5

Feedback on this post is welcomed on Discuss!

We are pleased to announce the patch release of opam 2.1.5.

This opam release consists of backported bug & security fixes:

  • Security issue: fix opam installing packages without checking their checksum when the local cache is corrupted in some case (#5538), you can find more information there.
  • Variables are now expanded in build-env (as for setenv) (#5352)
  • Correctly handle empty environment variable additions (#5350)
  • Skip empty environment variable additions (#5350)
  • Fix passing archive-mirrors field from init config file to config (#5315)
  • git, hg: Use the full SHA1 revision instead of just the 8 first characters (#5342)

Opam installation instructions (unchanged):

  1. From binaries: run

    bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.1.5"
    

    or download manually from the Github "Releases" page to your PATH. In this case, don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update you sandbox script.

  2. From source, using opam:

    opam update; opam install opam-devel
    

    (then copy the opam binary to your PATH as explained, and don't forget to run opam init --reinit -ni to enable sandboxing if you had version 2.0.0~rc manually installed or to update your sandbox script)

  3. From source, manually: see the instructions in the README.

We hope you enjoy this new minor version, and remain open to bug reports and suggestions.

See full changelog
  • [BUG] Variables are now expanded in build-env (as for setenv) [#5352 @dra27]
  • Correctly handle empty environment variable additions [#5350 @dra27]
  • Skip empty environment variable additions [#5350 @dra27]
  • [BUG] Fix passing archive-mirrors field from init config file to config [#5315 @hannesm]
  • git, hg: Use the full SHA1 revision instead of just the 8 first characters [#5342 @reynir]
  • [BUG] Fix opam installing packages without checking their checksum when the local cache is corrupted in some case [#5538 @kit-ty-kate]
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.