OCaml Changelog

RSS

Read the latest releases and updates from the OCaml ecosystem.

We are pleased to announce the release of OCaml LSP 1.18.0. This version comes with a lot of fixes and new features.

Notable features that are included in this release are:

  • Improved hover behavior with less noisy hovers on some parse tree nodes such as keywords, comments, etc., along with support for hovering over PPX annotations and preview the generated code.
  • Some additional custom queries, particularly TypeEnclosing
  • Folding ifthenelse expressions
  • A new configuration option to control Dune diagnostics
  • Improved document symbols

...and many fixes to a handful of issues.

Feedback is very much welcomed on the the Discuss Announcement post and do not hesistate to report issues in the issue tracker.

See full changelog

Features

  • Introduce a configuration option to control Dune diagnostics. The option is called duneDiganostics, and it may be set to { enable: false } to disable diagnostics. (ocaml/ocaml-lsp#1221)

  • Support folding of ifthenelse expressions (ocaml/ocaml-lsp#1031)

  • Improve hover behavior (ocaml/ocaml-lsp#1245)

    Hovers are no longer displayed on useless parse tree nodes such as keywords, comments, etc.

    Multiline hovers are now filtered away.

    Display expanded PPXs in the hover window.

  • Improve document symbols (ocaml/ocaml-lsp#1247)

    Use the parse tree instead of the typed tree. This means that document symbols will work even if the source code doesn't type check.

    Include symbols at arbitrary depth.

    Differentiate functions / types / variants / etc.

    This now includes PPXs like let%expect_test or let%bench in the outline.

  • Introduce a destruct-line code action. This is an improved version of the old destruct code action. (ocaml/ocaml-lsp#1283)

  • Improve signature inference to only include types for elements that were absent from the signature. Previously, all signature items would always be inserted. (ocaml/ocaml-lsp#1289)

  • Add an update-signature code action to update the types of elements that were already present in the signature (ocaml/ocaml-lsp#1289)

  • Add custom ocamllsp/merlinCallCompatible request (ocaml/ocaml-lsp#1265)

  • Add custom ocamllsp/typeEnclosing request (ocaml/ocaml-lsp#1304)

Fixes

  • Detect document kind by looking at Merlin's suffixes config.

    This enables more LSP features for non-.ml/.mli files. Though it still depends on Merlin's support. (ocaml/ocaml-lsp#1237)

  • Correctly accept the --clientProcessId flag. (ocaml/ocaml-lsp#1242)

  • Disable automatic completion and signature help inside comments (ocaml/ocaml-lsp#1246)

  • Includes a new optional/configurable option to toggle syntax documentation. If toggled on, allows display of syntax documentation on hover tooltips. Can be controlled via environment variables and by GUI for VS code. (ocaml/ocaml-lsp#1218)

  • For completions on labels that the LSP gets from Merlin, take into account whether the prefix being completed starts with ~ or ?. Change the label completions that start with ? to start with ~ when the prefix being completed starts with ~. (ocaml/ocaml-lsp#1277)

  • Fix document syncing (ocaml/ocaml-lsp#1278, ocaml/ocaml-lsp#1280, fixes ocaml/ocaml-lsp#1207)

  • Stop generating inlay hints on generated code (ocaml/ocaml-lsp#1290)

  • Fix parenthesising of function types in SignatureHelp (ocaml/ocaml-lsp#1296)

  • Fix syntax documentation rendering (ocaml/ocaml-lsp#1318)

We are pleased to announce the release of Merlin 5.1-502. This is an important release that brings a lot of backend changes and a major new feature: project-wide occurrences queries.

Try it by running dune build @ocaml-index (since dune 3.16.0) and performing a reference query!

More information can be found in the discuss announcement and the wiki.

See full changelog
  • merlin binary
    • Support project-wide occurrences queries using index files (ocaml/merlin#1766)
      • The file format is described in library Merlin_lib.index_format
      • Two new configuration directives are introduced:
        • SOURCE_ROOT that is used to resolve relative paths found in the indexes.
        • INDEX that is used to declare the list of index files Merlin should use when looking for occurrences.
    • A new UNIT_NAME configuration directive that can be used to tell Merlin the correct name of the current unit in the presence of wrapping (ocaml/merlin#1776)
    • Perform incremental indexation of the buffer when typing. (ocaml/merlin#1777)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)
    • Prevent uid clashes by not returning PWO for defs located in the current interface file (ocaml/merlin#1781)
    • Reset uid counters when restoring the typer cache so that uids are stable across re-typing (ocaml/merlin#1779)
    • Improve the behavior on occurrences when the cursor is on a label / constructor declaration (ocaml/merlin#1785)
  • editor modes
    • emacs: add basic support for project-wide occurrences (ocaml/merlin#1766)
    • vim: add basic support for project-wide occurrences (ocaml/merlin#1767, @Julow)

Dune 3.16.0

We're happy to announce the release of Dune 3.16.0.

Among the list of chances, this release contains improvements to Melange support and a way to look for references in a whole project using Merlin and OCaml LSP.

See full changelog

Added

  • Allow libraries with the same (name ..) in projects as long as they don't conflict during resolution (via enabled_if). (#10307, @anmonteiro, @jchavarri)

  • dune describe pp now finds the exact module and the stanza it belongs to, instead of guessing the name of the preprocessed file. (#10321, @anmonteiro)

  • Print the result of dune describe pp with the respective dialect printer. (#10322, @anmonteiro)

  • Add new flag --context to dune ocaml-merlin, which allows to select a Dune context when requesting Merlin config. Add dune describe contexts subcommand. Introduce a field generate_merlin_rules for contexts declared in the workspace, that allows to optionally produce Merlin rules for other contexts besides the one selected for Merlin (#10324, @jchavarri)

  • Melange: add include paths for private library .cmj files during JS emission. (#10416, @anmonteiro)

  • dune ocaml-merlin: communicate additional directives SOURCE_ROOT, UNIT_NAME (the actual name with wrapping) and INDEX with the paths to the index(es). (#10422, @voodoos)

  • Add a new alias @ocaml-index that uses the ocaml-index binary to generate indexes that can be read by tools such as Merlin to provide project-wide references search. (#10422, @voodoos)

  • Merlin: add optional (merlin_reader CMD) construct to (dialect) stanza to configure a Merlin reader (#8567, @andreypopp)

Changed

  • Melange: treat private libraries with (package ..) as public libraries, fixing an issue where import paths were wrongly emitted. (#10415, @anmonteiro)

  • Install .glob files for Coq theories too (#10602, @ejgallego)

Fixed

  • Don't try to document nonexistent libraries in doc-new target (#10319, fixes #10056, @jonludlam)

  • Make dune-site's load_all function look for META files so that it doesn't fail on empty directories in the plugin directory (#10458, fixes #10457, @shym)

  • Fix incorrect warning for libraries defined inside nonexistant directories using (subdir ..) and used by executables using dune-build-info (#10525, @rgrinberg)

  • Don't try to take build lock when running coq top --no-build (#10547, fixes #7671, @lzy0505)

  • Make sure to truncate Dune's lock file after locking and unlocking so that users cannot observe incorrect PID's (#10575, @rgrinberg)

  • MDX: link MDX binary with byte_complete. This fixes (libraries) with foreign archives on Linux. (#10586, fixes #10582, @anmonteiro)

  • Virtual libraries: fix an issue where linking an executable involving several virtual libries would cause an error. (#10581, fixes #10460, @rgrinberg)

We are pleased to announce the release of Merlin 4.16-414 and 4.16-501.

These releases expose additional functions for packages using merlin-lib that need to manually parse merlin commands.

See full changelog
  • merlin binary
    • Addition of a merlin-lib.commands library which disassociates the execution of commands from the new_protocol, from the binary, allowing it to be invoked from other projects (ocaml/merlin#1758)
    • merlin-lib.commands: Add a find_command_opt alternative to find_command that does not raise (ocaml/merlin#1778)

Feedback on this post is welcomed on Discuss!

We are very pleased to announce the third and final beta release of opam 2.2.0.

We've done our best to polish everything and squash as many bugs as possible in order to be ready for the final release. You can view the full list of changes in the release note.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we near the stable release.

Changes

  • Greatly enhance the opam init user experience on Windows, and the number of recognised configurations
  • New option opam init --cygwin-extra-packages=CYGWIN_PKGS --cygwin-internal-install, to specify additional packages for the internal Cygwin installation
  • Redirect the opam root to C:\opamroot\opam-xxx when the opam root contains spaces on Windows
  • Out-of-the-box UTF-8 paged --help on Windows
  • Fix a performance regression when calling opam install --deps-only on an already installed package
  • Fix several edge cases related to environment reverting
  • Fixed some issues that could appear when upgrading from previous versions of opam
  • Fix various issues with opam tree --with-test
  • Fix parsing opam 2.1 switch import files containing extra-files
  • Fix download URLs containing invalid characters on Windows
  • Fix some failure cases when extracting tarballs which contain symlinks on Windows

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Try it on Windows!

BEWARE: the command shown below is experimental, use caution and please do report any issues that you are experiencing. If you prefer to not use our experimental script, feel free to get the Windows binary directly from the Release Page and put it in your directory of choice instead.

Now that the Windows support was merged in opam-repository, testing is as simple as calling the following command from a PowerShell terminal:

Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/kit-ty-kate/opam/windows-installer/shell/install.ps1) }"

opening a new terminal, and a simple opam init will work out-of-the-box.

Try it on other platforms!

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~beta3"
    

    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.

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

We are pleased to announce the release of Merlin 4.15-414 and 4.15-501.

These releases bring a handful of bug fixes and improvements, notably to the destruct feature, that were already released for OCaml 5.2 in Merlin 5.0-502.

See full changelog
  • merlin binary
    • destruct: Removal of residual patterns (ocaml/merlin#1737, fixes ocaml/merlin#1560)
    • Do not erase fields' names when destructing punned record fields (ocaml/merlin#1734, fixes ocaml/merlin#1661)
    • Ignore SIGPIPE in the Merlin server process (ocaml/merlin#1746)
    • Fix lexing of quoted strings in comments (ocaml/merlin#1754, fixes ocaml/merlin#1753)
    • Improve cursor position detection in longidents (ocaml/merlin#1756)

Dune 3.15.3

We just released version 3.15.3 with some bug fixes.

See full changelog

Fixed

  • Fix interpretation of exists_if predicate in META files of installed libraries containing more than one element. (#10564, fixes #10563, @dbuenzli, @nojb)

  • Fix TSAN warning in wait4 stubs (#10554, fixes #10553, @emillon)

opam 2.1.5

Feedback on this post is welcomed on Discuss!

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

This opam release consists of backported bug fixes and improvements:

  • Changes necessary for opam-repository (see ocaml/opam-repository#23789)
    • Warn if GNU patch is not detected when a patch is applied (#5893)
    • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD (#5893)
    • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch (#5893)
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD (#5065)
  • Upgrade the vendored dune to 3.14.0 (#5869)
  • Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD (#5769)

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.6"
    

    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
  • Changes necessary for opam repository
  • Warn if GNU patch is not detected when a patch is applied [#5893 @kit-ty-kate]
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD [#5893 @kit-ty-kate]
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch [#5893 @kit-ty-kate]
  • Better recognize depexts on Gentoo, NetBSD, OpenBSD [#5065 @mndrix]
  • Upgrade the vendored dune to 3.14.0 [#5869 @kit-ty-kate]
  • Vendor mccs.1.1+17 [#5769 @kit-ty-kate]
  • Require mccs >= 1.1+17: Fix debug logs showing up regardless of verbosity on macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD [#5769 @kit-ty-kate]
  • API Changes:
  • OpamSystem.patch now displays a warning when GNU patch is not detected and looks for both patch and gpatch as a backup option depending on the OS [#5893 @kit-ty-kate]

Merlin 5.0

We are pleased to announce the release of Merlin 5.0-502!

This release brings official support for OCaml 5.2. Substantial backend changes were required to adapt to this release, especially for features such as occurrences and get-documentation. Do not hesitate to report any suspicious behavior in the issue tracker!

This release also fixes a handful of issues, two of them improving the behaviour of Merlin's destruct feature.

See full changelog
  • merlin binary
    • Support for OCaml 5.2 (#1757)
    • destruct: Removal of residual patterns (#1737, fixes #1560)
    • Do not erase fields' names when destructing punned record fields (#1734, fixes #1661)
    • Ignore SIGPIPE in the Merlin server process (#1746)
    • Fix lexing of quoted strings in comments (#1754, fixes #1753)
    • Improve cursor position detection in longidents (#1756)
    • Addition of a merlin-lib.commands library that disassociates the execution of commands from the new_protocol, from the binary, allowing it to be invoked from other projects (#1758)
    • New occurrences backend: Don't index occurrences when merlin.hide attribute is present. (#1768)
    • Use the new uid_to_decl table in 5.2's CMT files to get documentation. (#1773)

We have the pleasure of celebrating Inge Lehmann's birthday by announcing the release of OCaml version 5.2.0.

Some of the highlights in OCaml 5.2.0 are:

  • Reintroduced GC compaction
  • Restored native backend for POWER 64 bits
  • Thread sanitiser support
  • New Dynarray module
  • New -H flag for hidden include directories
  • Project-wide occurence metadata support for developer tools
  • Raw identifiers
  • Local open in type expressions

And a lot of incremental changes:

  • Around 20 new functions in the standard library
  • Many fixes and improvements in the runtime
  • Many bug fixes

OCaml 5.2.0 is still a somewhat experimental release compared to the OCaml 4.14 branch. In particular:

  • The Windows MSVC port is still unavailable.
  • Ephemeron performances need to be investigated.
  • statmemprof is being tested in the developer branch.
  • There are a number of known runtime concurrency or GC performance bugs (that trigger under rare circumstances).

Since the Windows MSVC port and statmemprof are still missing, the maintenance support for OCaml 4.14 will be extended until at least the end of the year.

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

(Changes that can break existing programs are marked with a "*")

Restored and New Backends:

  • #12276, #12601: Native-code compilation for POWER (64 bits, little-endian) (Xavier Leroy, review by KC Sivaramakrishnan, Anil Madhavapeddy, and Stephen Dolan)

  • #12667: Extend the latter to POWER 64 bits, big-endian, ELFv2 ABI (A. Wilcox, review by Xavier Leroy)

Runtime System:

  • #12193: Reintroduce GC compaction for shared pools. Adds a parallel compactor for the shared pools (which contain major heap blocks sized less than 128 words). Explicit only for now, on calls to Gc.compact. (Sadiq Jaffer, Nick Barnes, review by Anil Madhavapeddy, Damien Doligez, David Allsopp, Miod Vallat, Artem Pianykh, Stephen Dolan, Mark Shinwell, and KC Sivaramakrishnan)

  • #12114: Add ThreadSanitizer support (Fabrice Buoro and Olivier Nicole, based on an initial work by Anmol Sahoo, review by Damien Doligez, Sébastien Hinderer, Jacques-Henri Jourdan, Luc Maranget, Guillaume Munch-Maccagnoni, Gabriel Scherer)

  • #12850: Update Gc.quick_stat data at the end of major cycles and compaction. This PR adds an additional caml_collect_gc_stats_sample_stw to the major heap cycling STW. This means that Gc.quick_stat now actually reflects the state of the heap after a major cycle or compaction. (Sadiq Jaffer, review by Miod Vallat and Gabriel Scherer)

  • #12859: Ensure Gc.compact does a full major before the compactor runs (Sadiq Jaffer, review by Leo White, Mark Shinwell, Gabriel Scherer, Josh Berdine, David Allsopp, and KC Sivaramakrishnan)

  • #10111: Increase the detail of location information for debugging events to allow the end-line number and character offset to be reported. (David Allsopp, review by Nick Barnes, Enguerrand Decorne and Stephen Dolan)

  • #10403, #12202: Introduce caml_ext_table_add_noexc that does not raise Out_of_memory exceptions, and use it inside the blocking sections of caml_read_directory. Also, check for overflows in EXT table sizes. (Xavier Leroy, report by Arseniy Alekseyev, review by Gabriel Scherer)

  • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

  • #12772, #12787: Avoid using _Bool in public headers for the sake of C++ compatibility (Guillaume Munch-Maccagnoni, report by KC Sivaramakrishnan, review by Xavier Leroy and KC Sivaramakrishnan)

  • #12223: Constify constructors and flags tables in C code. Now these tables will go in the read-only segment where they belong. (Antonin Décimo, review by Gabriel Scherer and Xavier Leroy)

  • #12234: Make instrumented time calculation more thread-safe on macOS. (Anil Madhavapeddy, review by Daniel Bünzli and Xavier Leroy)

  • #12235, #12468: Introduce and use the CAMLnoret macro as a lighter alternative to CAMLnoreturn_start / CAMLnoreturn_end. Implement it so as to conform with C11, C23, C++11, C++17. (Xavier Leroy and Dhruv Maroo, with help from Antonin Décimo, review by Gabriel Scherer and David Allsopp)

  • #12275: caml/stack.h: More abstract macros to describe OCaml stacks and how to traverse them, supporting more stack layouts. (Xavier Leroy, review by KC Sivaramakrishnan and Fabrice Buoro)

  • #12268: Deliver Out_of_memory exception if domain creation fails due to memory resource exhaustion. Previously, it was always a Failure. (Anil Madhavapeddy, review by David Allsopp)

  • #12300, #12314: Discard out_channel buffered data on permanent I/O error (Xavier Leroy, report by Török Edwin, review by Anil Madhavapeddy and Nicolás Ojeda Bär)

  • #11386: Simplifications and fixes to Multicore systhreads implementation. (Guillaume Munch-Maccagnoni, review by Anil Madhavapeddy and KC Sivaramakrishnan)

  • #12875, #12879, #12882: Execute preemptive systhread switching as a delayed pending action. This ensures that one can reason within the FFI that no mutation happens on the same domain when allocating on the OCaml heap from C, consistently with OCaml 4. This also fixes further bugs with the Multicore systhreads implementation. (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark Shinwell, review by Nick Barnes and Stephen Dolan)

  • #12408: Domain.spawn no longer leaks its functional argument for the whole duration of the children's domain lifetime. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer)

  • #12409: Fix unsafety and deadlocks should an asynchronous exception arise at specific locations during domain creation and shutdown. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer)

  • #11911, #12381: Restore statmemprof functionality in part, with some API changes in Gc.Memprof. (Nick Barnes, review by Jacques-Henri Jourdan and Guillaume Munch-Maccagnoni).

  • #12430: Simplify dynamic bytecode loading in Meta.reify_bytecode (Stephen Dolan, review by Sébastien Hinderer, Vincent Laviron and Xavier Leroy)

  • #12489: Fix an error-handling bug in caml_alloc_sprintf (Stephen Dolan, report by Chris Casinghino, review by Jeremy Yallop and Xavier Leroy)

  • #11307: Finish adapting the implementation of asynchronous actions for Multicore: soundness, liveness, and performance issues. Do not crash if a signal handler is called from an unregistered C thread and other possible soundness issues. Prevent issues where joins on other domains could make the toplevel unresponsive to Ctrl-C. Avoid needless repeated polling in C code when callbacks cannot run immediately. (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier Leroy, and KC Sivaramakrishnan)

  • #12634: Simplify TSan backtrace bookkeeping upon raise (Olivier Nicole and Fabrice Buoro, review by Gabriel Scherer)

  • (Breaking Change) #12686: Some primitives had the wrong types to be callable from the bytecode interpreter. Either fix their types, mark them as CAMLexport instead of CAMLprim, or remove them entirely if no longer used. (Xavier Leroy, review by David Allsopp)
  • #12700, continuing #11763 and trying to address #12660: Use the correct types for primitives when generating the table of primitives used by ocamlrun. (Xavier Leroy, motivation, review and improvements by Antonin Décimo)

  • #12345, #12710: Fix issues with finaliser orphaning at domain termination (KC Sivaramakrishnan, report by Gabriel Scherer, review by Gabriel Scherer, Sadiq Jaffer and Fabrice Buoro)

  • #12599: Refactor Dynlink startup to avoid parsing bytecode sections twice (Stephen Dolan, review by David Allsopp, Hugo Heuzard, Damien Doligez and Xavier Leroy)

  • #12678, #12898: Free channel buffers on close rather than on finalisation (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report by Jan Midtgaard)

  • #12681: Fix TSan false positives due to volatile write handling (Olivier Nicole, Fabrice Buoro, and Anmol Sahoo, review by Luc Maranget, Gabriel Scherer, Hernan Ponce de Leon, and Xavier Leroy)

  • #12743: Use pthread_sigmask instead of sigprocmask. Updates usage of sigprocmask to pthread_sigmask in otherlibs/unix. (Max Slater, review by Miod Vallat and Xavier Leroy)

  • #12769: Unify MSVC and MinGW-w64 code paths, by always using WinAPI directly. (David Allsopp, Antonin Décimo, and Samuel Hym, review by Nicolas Ojeda Bar)

  • #11911, #12382, #12383: Restore statmemprof functionality in part (backtrace buffers, per-thread and per-domain data structures, GC/allocation interface). (Nick Barnes, review by Gabriel Scherer, Fabrice Buoro, Sadiq Jaffer, Guillaume Munch-Maccagnoni, and Jacques-Henri Jourdan).

  • #12735: Store both ends of the stack chain in continuations (Leo White, review by Miod Vallat and KC Sivaramakrishnan)

  • #12746: Simplify and clean up TSan annotations (Olivier Nicole, review by Miod Vallat and Fabrice Buoro)

  • #12809: Add ThreadSanitizer support to FreeBSD/AMD64 (Miod Vallat, review by Gabriel Scherer)

  • #12810: Port ThreadSanitizer support to Linux and macOS on arm64 (Miod Vallat, review by Tim McGilchrist)

  • #12811: Define and use the CAMLthread_local macro for TLS variables. (Antonin Décimo and Samuel Hym, review by Miod Vallat and Xavier Leroy)

  • #12814: More detailed failure messages from input_value and Marshal.from_* (Xavier Leroy, review by Stephen Dolan and Anil Madhavapeddy)

  • #12815: Correctly format multiline locations in exception backtraces in the compiler driver's style. (David Allsopp, review by Gabriel Scherer)

  • #12773, #12830, #12834: Rewrite caml_c_thread_(un)register to fix various bugs. (Guillaume Munch-Maccagnoni, reported by Miod Vallat, suggested by Hari Hara Naveen S, reviewed by Fabrice Buoro, Gabriel Scherer, and Miod Vallat)

  • #12876: Port ThreadSanitizer support to Linux on POWER (Miod Vallat, review by Tim McGilchrist)

  • #12886: Reinitialise I/O mutexes after fork (Max Slater, review by Guillaume Munch-Maccagnoni and Xavier Leroy)

  • #12907: Port ThreadSanitizer support to Linux on RiscV (Miod Vallat, review by Nicolás Ojeda Bär and Fabrice Buoro)

  • #12915: Port ThreadSanitizer support to Linux on s390x (Miod Vallat, review by Tim McGilchrist)

  • #12934: Fix data races between marking and sweeping functions (Olivier Nicole, suggested by Stephen Dolan, review by Gabriel Scherer, Miod Vallat, and Damien Doligez)

Language Features:

  • #12295, #12568: Give while true a polymorphic type, similarly to assert false (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer, suggestion by Rodolphe Lepigre and John Whitington)

  • #12044: Add local module open syntax for types.

      module A = struct
        type t = int
        type r = unit
        type s = string
      end
    
      type example = A.(t * r * s)
    

    (Alistair O'Brien, review by Gabriel Scherer, Nicolás Ojeda Bär, and Florian Angeletti)

  • #11252, RFC 27: Support raw identifier syntax \#foo (Stephen Dolan, review by David Allsopp, Gabriel Scherer, and Olivier Nicole)

  • #12315: Use type annotations from arguments in let rec (Stephen Dolan, review by Gabriel Scherer)

  • #12375: Allow use of [@untagged] for all immediate types like char, bool, and variant with only constant constructors. (Christophe Raffalli, review by Gabriel Scherer)

  • (Breaking Change) #12502: The compiler now normalises the newline sequence \r\n to a single \n character during lexing to guarantee that the semantics of newlines in string literals are not modified by Windows tools transforming \n into \r\n in source files. Warning 29 [eol-in-string] is not emitted anymore, as the normalisation gives more robust semantics to newlines in string literals. (Gabriel Scherer and Damien Doligez, review by Daniel Bünzli, David Allsopp, Andreas Rossberg, Xavier Leroy, report by Andreas Rossberg)

Standard Library:

  • #11563: Add the Dynarray module to the stdlib. Dynamic arrays are arrays whose length can be changed by adding or removing elements at the end, similar to 'vectors' in C++ or Rust. (Gabriel Scherer, Simon Cruanes, and Florian Angeletti, review by Daniel Bünzli, Guillaume Munch-Maccagnoni, Clément Allain, Damien Doligez, Wiktor Kuchta, and Pieter Goetschalckx)

  • #12716: Add Format.pp_print_nothing function. (Léo Andrès, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • (Breaking Change) #6732, #12423: Make Buffer.add_substitute surjective and fix its documentation. (Damien Doligez, review by Antonin Décimo)

  • (Breaking Change) #10775, #12499: Half-precision, floating-point elements in Bigarray. (Anton Yabchinskiy, review by Xavier Leroy and Nicolás Ojeda Bär)

  • #11517, #12477: Expose pp_infinity in interface of the format module and check that margin is less than pp_infinity when setting or checking geometry. (Janith Petangoda, reported by Simmo Saan, reviewed by Florian Angeletti, Simmo Saan, Josh Berdine, and Gabriel Scherer)

  • #12217: Add Array.shuffle. (Daniel Bünzli, review by Nicolás Ojeda Bär, David Allsopp, and Alain Frisch)

  • #12212: Add cache-aligned constructor for atomics. The patch ensures that all allocations (of the right size) in the shared heap are aligned. (Bartosz Modelski with Gabriel Scherer, Guillaume Munch-Maccagnoni, Xavier Leroy, review by Alain Frisch, Anil Madhavapeddy, Gabriel Scherer, Guillaume Munch-Maccagnoni, KC Sivaramakrishnan, Stefan Muenzel, Xavier Leroy)

  • #12307: Add BLAKE2b hashing and an MD5 submodule to the Digest module. (Xavier Leroy, review by Olivier Nicole, Gabriel Scherer, Wiktor Kuchta, Daniel Bünzli, David Allsopp)

  • #12365: Add In_channel.input_bigarray, In_channel.really_input_bigarray, Out_channel.output_bigarray, Unix.read_bigarray, Unix.write_bigarray, Unix.single_write_bigarray. (Nicolás Ojeda Bär, review by Jeremy Yallop, Xavier Leroy, Gabriel Scherer, David Allsopp)

  • #12455: Add Array.init_matrix, Float.Array.make_matrix, Float.Array.init_matrix. (Glen Mével, review by Xavier Leroy, Gabriel Scherer, Jeremy Yallop, Nicolas Ojeda Bar)

  • (Breaking Change) #12455: Array.make_matrix dimx dimy f now raises Invalid_argument when dimx = 0 && dimy < 0. This was already specified but not enforced. (Glen Mével, report by Jeremy Yallop, review by Nicolas Ojeda Bar)
  • #12459: Add Random.int_in_range, Random.int32_in_range, Random.int64_in_range, Random.nativeint_in_range, and their counterpart in Random.State. (Glen Mével and Xavier Leroy, review by Gabriel Scherer, Xavier Leroy, Florian Angeletti)

  • #12459: Random: Restore compatibility between 32-bit integers (JavaScript) and 63-bit integers (64-bit OCaml). For Random.full_int this was guaranteed in 4.14 but wrongly removed in 5.0. (Xavier Leroy, review by Glen Mével)

  • #12511: Minor performance improvements and cleanups in the implementation of modules Int32, Int64, and Nativeint (Xavier Leroy, review by Gabriel Scherer and Daniel Bünzli)

  • #12558: Adapt GC alarms for Multicore and fix their documentation. (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan and Gabriel Scherer)

  • #12625: Remove the Closure module from Obj (Vincent Laviron, review by Xavier Leroy)

  • #12758, #12998: Remove the Marshal.Compression flag to the Marshal.to_* functions. The compilers are still able to use ZSTD compression for compilation artefacts. This is a forward port and clean-up of the emergency fix that was introduced in OCaml 5.1.1 by #12734. (Xavier Leroy, review by Damien Doligez)

  • #12784: Fix computation of minor-heap allocation in Gc.counters() and Gc.allocated_bytes(). (Nick Barnes, review by Gabriel Scherer)

  • #12770: Add Fun.compose. (Justin Frank, review by Nicolás Ojeda Bär, Daniel Bünzli, and Jeremy Yallop)

  • #12845: Add {In,Out}_channel.is_binary_mode as the dual of set_binary_mode. This function was previously only available in the internal C API. (David Allsopp, review by Nicolás Ojeda Bär and Xavier Leroy)

Type System:

  • #12313, #11799: Do not rebuild as-pattern types when a ground type annotation is given. This allows to work around problems with GADTs in as-patterns. (Jacques Garrigue, report by Leo White, review by Gabriel Scherer)

Code Generation and Optimisations:

  • #11239: On x86-64 and RISC-V, reduce alignment of OCaml stacks from 16 to 8. This reduces stack usage. It's only C stacks that require 16-alignment. (Xavier Leroy, review by Gabriel Scherer and Stephen Dolan)

  • #12311: On POWER, 32-bit FP numbers stored in memory (e.g., in Bigarrays) were not correctly rounded sometimes. (Xavier Leroy, review by Anil Madhavapeddy and Tim McGilchrist)

  • #12551, #12608, #12782, #12596: Overhaul of recursive value compilation. Non-function recursive bindings are now forbidden from Lambda onwards, and they're compiled using a new Value_rec_compiler module. (Vincent Laviron and Lunia Ayanides, review by Gabriel Scherer, Stefan Muenzel and Nathanaëlle Courant)

  • #1809, #12181: Rewrite compare x y op 0 to x op y when values are integers (Xavier Clerc, Stefan Muenzel, review by Gabriel Scherer and Vincent Laviron)

  • #12825: Disable common subexpression elimination for atomic loads... again. (Gabriel Scherer, review by KC Sivaramakrishnan, Xavier Leroy and Vincent Laviron, report by Vesa Karvonen)

Other Libraries:

  • #12213: Dynlink library, improve legibility of error messages (Samuel Hym, review by Gabriel Scherer and Nicolás Ojeda Bär)
  • (Breaking Change) #12686: Runtime_events library, C API: define caml_runtime_events_{start,pause,resume} as returning void instead of value. (Xavier Leroy, review by David Allsopp)

Compiler User-Interface and Warnings:

  • #11989, #12246, RFC 31: New flag, -H, to allow for transitive dependencies without including them in the initial environment. (Chris Casinghino, François Bobot, and Gabriel Scherer, review by Leo White and Stefan Muenzel, RFC by François Bobot)
  • (Breaking Change) #10613, #12405: Simplify the values used for the system variable (system: in ocamlopt -config or the Config.system constant). In particular, s390x and ppc64 now report "linux" instead of "elf"; all variants of 32-bit ARM on Linux now report "linux"; OpenBSD now reports "openbsd" instead of "bsd" for 32-bit ARM; FreeBSD, NetBSD, and OpenBSD now report the same value for both x86_64 and x86_32; x86_32 systems matching BSD but not FreeBSD, NetBSD*, or OpenBSD* are no longer identified (as on x86_64); x86_32 Linux now reports "linux" instead of "linux_elf". (David Allsopp, request by Kate Deplaix, review by Sébastien Hinderer and Xavier Leroy)
  • #12247: Configure: --disable-ocamldebug can now be used instead of --disable-debugger (which remains available for compatibility) (Gabriel Scherer, review by Damien Doligez and Sébastien Hinderer)

  • #12199: Improve the error message for non-overriding inherit! (Florian Angeletti, review by Jules Aguillon)

  • #12210: Uniform style for inline code in compiler messages (Florian Angeletti, review by Gabriel Scherer)

  • (Breaking Change) #12278, #:12325: Remove the OCAML_FLEXLINK environment variable from the compiler drivers. This environment variable was previously used as part of the FlexDLL bootstrap procedure and existed solely for that purpose. Its removal greatly simplifies both the build system and testsuite machinery. (David Allsopp, review by Sébastien Hinderer)
  • #12347: Error messages: always report missing polyvariant tags (Florian Angeletti, report by Tianbo Hao, review by Gabriel Scherer)

  • #12224: Specialised error message when trying to apply non-functor module (e.g., module M = Int(Int)) (Florian Angeletti, review by Gabriel Scherer)

  • #12451: Warning 53 (misplaced attributes) now works for all attributes. (Chris Casinghino, review by Florian Angeletti)

  • #12622: Give hints about existential types appearing in error messages (Leo White, review by Gabriel Scherer and Florian Angeletti)

  • #12671: When a class type parameter or class parameter does not match, identify which parameter in the error message, instead of saying "A type parameter" or "A parameter." (Stefan Muenzel, review by Gabriel Scherer)

  • #12679: Add more detail to the error message and manual in case of invalid module type substitutions. (Stefan Muenzel, review by Gabriel Scherer and Florian Angeletti)

  • #12750: Display the command executed to extract primitives in ocamlc -verbose (David Allsopp, review by Nicolás Ojeda Bär)

  • #12777: Add details about the actual and expected method types to the method mismatch error messages (Javier Chávarri, review by Gabriel Scherer and Florian Angeletti)

  • (Breaking Change) #12942: Fix line ordering in some module inclusion error messages (Nick Roberts, review by Florian Angeletti, report by Carl Eastlund)

Manual and Documentation:

  • #12338: Clarification of the documentation of process related function in the Unix module regarding the first element of arguments and shell's PID (Christophe Raffalli, review by Florian Angeletti)

  • #12473: Document in runtime/memory.c our current understanding of accesses to the OCaml heap from the C runtime code -- the problem of hybrid programs mixing two memory models (Gabriel Scherer and Guillaume Munch-Maccagnoni, review by Olivier Nicole and Xavier Leroy)

  • #12456: Document the incompatibility between effects, on one hand, and caml_callback and asynchronous callbacks (signal handlers, finalisers, memprof callbacks...), on the other (Guillaume Munch-Maccagnoni, review by KC Sivaramakrishnan)

  • #12694: Document in runtime/tsan.c the TSan instrumentation choices and the consequences with regard to the memory model (Olivier Nicole, review by Miod Vallat, Gabriel Scherer, Guillaume Munch-Maccagnoni and Fabrice Buoro)

  • #12802: Add manual chapter about ThreadSanitizer support (Olivier Nicole, review by Miod Vallat, Sebastien Hinderer, Fabrice Buoro, Gabriel Scherer and KC Sivaramakrishnan)

  • #12819: Clarify which runtime interactions are allowed in custom ops (Basile Clément, review by Guillaume Munch-Maccagnoni and Xavier Leroy)

  • #12840: Manual: update runtime tracing chapter for custom events (e.g., #12335) (Lucas Pluvinage, Sadiq Jaffer and Olivier Nicole, review by Gabriel Scherer, David Allsopp, Tim McGilchrist, and Thomas Leonard)

  • #13066: Update OCAMLRUNPARAM documentation for the stack size parameter l (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and Miod Vallat)

  • #13078: Update Format tutorial on structural boxes to mention alignment questions (Edwin Török, review by Florian Angeletti)

  • #13092: Document the existence of the [@@poll error] built-in attribute (Florian Angeletti, review by Gabriel Scherer)

Tools:

  • #12340: testsuite: collect known issues with current -short-paths implementation for existential types (Florian Angeletti, Samuel Hym, review by Florian Angeletti and Thomas Refis)

  • #12147: ocamllex: allow carriage returns at the end-of-line directives (SeungCheol Jung, review by Nicolás Ojeda Bär)

  • #12260: Fix invalid_argument on some external or module aliases in ocamlnat (Fabian Hemmer, review by Vincent Laviron)

  • #12185: New script language for ocamltest (Damien Doligez with Florian Angeletti, Sébastien Hinderer, Gabriel Scherer, review by Sébastien Hinderer and Gabriel Scherer)

  • #12371: ocamltest: fix recursive expansion of variables (Antonin Décimo, Damien Doligez, review by Sébastien Hinderer, Damien Doligez, Gabriel Scherer, and Xavier Leroy)

  • (Breaking Change) #12497, #12613: Make ocamlc/ocamlopt fail with an error when no input files are specified to build an executable (Antonin Décimo, review by Sébastien Hinderer)
  • #12576: ocamldep : various refactors (Antonin Décimo, review by Florian Angeletti, Gabriel Scherer, and Léo Andrès)

  • #12615: ocamldoc: get rid of the odoc_literate and odoc_todo generators (Sébaistien Hinderer, review by Gabriel Scherer and Florian Angeletti)

  • #12624: Use $XDG_CONFIG_DIRS in addition to $XDG_CONFIG_HOME when searching for init.ml, and use this to extend init.ml support to the toplevel when running on Windows. (David Allsopp, report by Jonah Beckford, review by Nicolás Ojeda Bär and Antonin Décimo)

  • #12688: Setting the env variable NO_COLOR with an empty value no longer has effects. Previously, setting NO_COLOR with any value, including the empty value, would disable colours (unless OCAML_COLOR is also set). After this change, the user must set NO_COLOR with an non-empty value to disable colours. This reflects a specification clarification/change from the upstream website at https://no-color.org. (Favonia, review by Gabriel Scherer)

  • #12744: ocamltest: run tests in recursive subdirs more eagerly (Nick Roberts, review by Nicolás Ojeda Bär)

  • #12901, 12908: ocamllex: add overflow checks to prevent generating incorrect lexers; use unsigned numbers in the table encoding when possible (Vincent Laviron, report by Edwin Török, review by Xavier Leroy)

Internal/compiler-libs Changes:

  • #12508 : Add compiler-side support for project-wide occurrences in Merlin by generating index tables of all identifier occurrences. This extra data in .cmt files is only added when the new flag -bin-annot-occurrences is passed. (Ulysse Gérard, Nathanaëlle Courant, suggestions by Gabriel Scherer and Thomas Refis, review by Florian Angeletti, Gabriel Scherer, and Thomas Refis)

  • #12236, #12386, #12391, #12496, #12673: Use syntax as sole determiner of arity. This changes function arity to be based solely on the source program's parsetree. Previously, the heuristic for arity had more subtle heuristics that involved type information about patterns. Function arity is important because it determines when a pattern match's effects run and is an input into the fast path for function application.

    This change affects tooling; it changes the function constructs in parsetree and typedtree.

    See https://github.com/ocaml/RFCs/pull/32 for the original RFC.

    (Nick Roberts; review by Richard Eisenberg, Leo White, and Gabriel Scherer; RFC by Stephen Dolan)

  • #12639: Parsing: attach a location to the RHS of Ptyp_alias and improve the 'alias type mismatch' error message. (Jules Aguillon, review by Florian Angeletti)

  • #12447: Remove 32-bit targets from X86_proc.system (Masanori Ogino, review by David Allsopp)

  • #12216, #12248: Prevent reordering of atomic loads during instruction scheduling. This is for reference, as instruction scheduling is currently unused in OCaml 5. (Xavier Leroy, report by Luc Maranget and KC Sivaramakrishnan, review by Nicolás Ojeda Bär)

  • #12025: Split Typecore.unify_pat_types into two in order to avoid unnecessary references to the environment in type_pat (Jacques Garrigue and Takafumi Saikawa, review by Gabriel Scherer)

  • #12031: Use dedicated types to represent names of compilation units and predefined exceptions in CMO files. (Sébastien Hinderer, review by Florian Angeletti, Thomas Refis, Gabriel Scherer, Vincent Laviron, Pierre Chambart, Luke Maurer, Hugo Heuzard, Xavier Leroy, and Damien Doligez)

  • #12109: Pack parameters to unification in unification_environment (Takafumi Saikawa and Jacques Garrigue, review by Richard Eisenberg)

  • #12331, #12361: Pack the unification data for pattern checking in Typecore (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer, Thomas Refis, and Florian Angeletti)

  • #12229: Remove global mutable state for typechecking patterns in Typecore in favor of local mutable state. (Nick Roberts, review by Takafumi Saikawa)

  • #12542: Minor bugfix to #12236: restore dropped call to instance (Nick Roberts, review by Jacques Garrigue)

  • #12242: Move the computation of stack frame parameters to a separate Stackframe module, and save the parameters in the results of the Linearize pass. (Xavier Leroy, review by KC Sivaramakrishnan and Mark Shinwell)

  • #12442: Document jump summaries in the pattern-matching compiler (Gabriel Scherer and Thomas Refis, review by Florian Angeletti and Vincent Laviron)

  • #12446, #12792: Remove the hooks machinery around channel locking in runtime/io.c (Gabriel Scherer, review by Xavier Leroy)

  • #12389, #12544, #12984, #12987: Centralise the handling of metadata for compilation units and artifacts in preparation to improve Unicode support for OCaml source files. (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer)

  • #12532, #12553: Improve readability of the pattern-matching debug output (Gabriel Scherer, review by Thomas Refis)

  • #12537: Use C11/C++11 standard static assertion (Antonin Décimo, review by Sebastien Hinderer, Xavier Leroy, and KC Sivaramakrishnan)

  • #12169: Runtime: document and enforce naming conventions around STW sections (Gabriel Scherer, review by Enguerrand Decorne, Miod Vallat, B. Szilvasy and Nick Barnes, report by KC Sivaramakrishnan)

  • #12669 : Clean up some global state handling in schedgen (Stefan Muenzel, review by Miod Vallat and Gabriel Scherer)

  • #12640: Make the module separator used in symbol names configurable (Miod Vallat, review by Hugo Heuzard and Xavier Leroy)

  • #12691 : Clean up Ctype.expand_abbrev_gen and rename Env.add_local_type to add_local_constraint (Takafumi Saikawa and Jacques Garrigue, review by Florian Angeletti)

  • #12786 : Clean up the algorithm of Ctype.limited_generalize (Takafumi Saikawa and Jacques Garrigue, review by Gabriel Scherer)

  • #10691: Ast_mapper, Ast_iterator: add functions directive_argument, toplevel_directive, and toplevel_phrase (Guillaume Petiot, review by Gabriel Scherer and Kate Deplaix)

  • #12764: Move all installable headers in caml/ subdirectories. (Antonin Décimo, review by Gabriel Scherer and David Allsopp)

  • #12914: Slightly change the s390x assembly dialect in order to build with Clang's integrated assembler (Miod Vallat, review by Gabriel Scherer)

  • #13001: Do not read_back entire shapes to get aliases' UIDs when building the usages index (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant)

Build System:

  • #12198, #12321, #12586, #12616, #12706, #13048: Continue the merge of the sub-Makefiles into the root Makefile started with #11243, #11248, #11268, #11420 and #11675. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #12569, #12570: Remove otherlibraries as a prerequisite for runtop; use runtop-with-otherlibs to use a library from otherlibs/ (Gabriel Scherer, review by Sébastien Hinderer, suggestion by David Allsopp)

  • #12652: Make magic numbers easier to bump and duplicate (Sébastien Hinderer, review by Antonin Décimo, David Allsopp and Florian Angeletti)

  • (Breaking Change) #12751: --with-target-bindir configure option implemented. This option refers to the location of the runtime binaries on the target system for a cross-compiler and is embedded in executables produced by ocamlc. It does not affect the bytecode executables installed as part of the build. The old mechanism make TARGET_BINDIR=.. no longer works. (David Allsopp, review by Damien Doligez, Xavier Leroy, and Olivier Nicole)
  • #12768, #13030: Detect MinGW-w64 coupling with GCC or LLVM, detect clang-cl, and fix C compiler feature detection on macOS. (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer)

Bug Fixes:

  • #10652, #12720: Fix evaluation order in presence of optional arguments (Jacques Garrigue, report by Leo White, review by Vincent Laviron)

  • #12595, #12597: Fix a race in caml_clear_gc_stats_sample (Gabriel Scherer, review by B. Szilvasy, report by B. Szilvasy)

  • #12580: Fix location of alias pattern variables (Chris Casinghino, review Gabriel Scherer, report by Milo Davis)

  • #12583: Add a closing event for when EV_MAJOR_EPHE_MARK is complete (Sudha Parimala, review by Gabriel Scherer)

  • #12566: caml_output_value_to_malloc wrongly uses caml_stat_alloc instead of malloc since 4.06, breaking (in pooled mode) user code that uses free on the result. Symmetrically, caml_input_value_from_malloc should use free. (Gabriel Scherer, review by Xavier Leroy and Enguerrand Decorne, report by Ido Yariv)

  • #12490: Unix: protect the popen_processes hashtable with a mutex (Gabriel Scherer, report by Olivier Nicole, review by Xavier Leroy)

  • #11931: Fix tricky typing bug with type substitutions (Stephen Dolan, review by Leo White and Jacques Garrigue)

  • #12037, #12171: Fix get_extern_state potential NULL dereference (Alexander Skvortsov, report by Török Edwin, design by Gabriel Scherer, Xavier Leroy)

  • #12635: Fix get_intern_state potential NULL dereference (Antonin Décimo, review by KC Sivaramakrishnan)

  • #12032, #12059: Bug fixes related to compilation of recursive definitions (Vincent Laviron, report by Victoire Noizet, review by Gabriel Scherer)

  • (Breaking Change) #12145: Loopy constraints cause ocamlc to loop. Fixed by completely removing the call to update_type in Typedecl.transl_type_decl, as the expansion is already checked by check_regularity. As a result, recursion is more polymorphic, which may cause some (essentially wrong) type declarations to have unbound type variables and some constraints unrelated to the concrete type to be ignored (see tests/typing-misc/constraints.ml). (Jacques Garrigue, report by Richard Eisenberg, review by Leo White)
  • #12207, #12222: Make closure computation linear in the number of recursive functions instead of quadratic (Vincent Laviron, report by François Pottier, review by Nathanaëlle Courant and Gabriel Scherer)

  • #11040, #12591: Fix a data race in major_gc.c (Gabriel Scherer, review by Guillaume Munch-Maccagnoni and KC Sivaramakrishnan, report by Sadiq Jaffer)

  • #12238, #12403, #12698: Read input files in one go to avoid source reprinting issues (Gabriel Scherer, report by Mike Spivey and Vincent Laviron, review by Nicolás Ojeda Bär, Xavier Leroy and Jeremy Yallop)

  • #12334, #12368: Bad error message with mutually recursive abbreviations (Jacques Garrigue, report by Richard Eisenberg, review by Gabriel Scherer and Richard Eisenberg)

  • #12401: seek_in and seek_out sometimes returned normally when given negative offsets, instead of failing. Now both functions should consistently raise Sys_error in this case. (Nicolás Ojeda Bär, review by Gabriel Scherer)

  • #12267: Fix stack alignment computation (Miod Vallat, report by Jan Midtgaard, review by Gabriel Scherer)

  • #12395, #12404: Fix thread-unsafety in the fallback implementation of Unix.create_process (the one used when posix_spawnp is unavailable) (Xavier Leroy, report by Chris Vine, review by Nicolás Ojeda Bär)

  • #12949: Open shadowing mistriggers (Gabriel Scherer, review by Florian Angeletti, report by Andreas Rossberg)

  • #12526: Honor ocaml.inline always attribute on functions with optional arguments and default values in the Closure backend (Alain Frisch, review by Vincent Laviron)

  • #12677, #12889: Make Domain.DLS thread-safe (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, report by Vesa Karvonen)

  • #12561: Fix crash when combining TSan and frame-pointers (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard, review by Miod Vallat and Gabriel Scherer)

  • #12482: Rework bounds checking code in the POWER backend (Miod Vallat and Xavier Leroy, report by Jan Midtgaard, review by KC Sivaramakrishnan)

  • #12528, #12703: Avoid pointer arithmetic overflow in Tag_val macro (very likely harmless, but can trigger alarms) (Xavier Leroy, report by Sam Goldman, review by Guillaume Munch-Maccagnoni)

  • #12593: TSan should handle Effect.Unhandled correctly (Fabrice Buoro and Olivier Nicole, report by Jan Midtgaard and Miod Vallat, review by Gabriel Scherer)

  • #12684: Fix locations filename in AST produced by the -pp option (Gabriel Scherer, review by Florian Angeletti)

  • #12714: Check whether macros are defined before using them to ensure that the headers can always be used in code which turns on -Wundef (or equivalent). (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, Xavier Leroy, and David Allsopp)

  • #12726: Fix segmentation fault under Windows when executing a bytecode file if the runtime (ocamlrun.exe) cannot be found. (Vadim Zborovskii, Nicolás Ojeda Bär, report by Vadim Zborovskii, review by David Allsopp)

  • #12727, #12730: Fix bug with value let-rec and labelled applications (Vincent Laviron, review by Gabriel Scherer)

  • (Breaking Change) #12751: Always keep within the 128 character limit for shebang lines. Previous fix in #8622 handled building the compiler with a long prefix. This patch extends this to the bytecode executables emitted by that compiler. (David Allsopp, review by Damien Doligez, Xavier Leroy, and Olivier Nicole)
  • #12755: Fix data race on global pools arrays of pool_freelist (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer)

  • #12796, #12801: Fix memory corruption in caml_unix_alloc_sockaddr (Thomas Leonard, review by Nicolás Ojeda Bär)

  • #12737: Fix data races in minor_gc.c and caml_natdynlink_open (Olivier Nicole, review by Stefan Muenzel, Miod Vallat, Guillaume Munch-Maccagnoni, Gabriel Scherer, and Xavier Leroy)

  • #12831: Fix call to caml_call_realloc_stack for s390x in PIC mode (Vincent Laviron, report by Jerry James, review by Miod Vallat)

  • (Breaking Change) #12837: Show non-generalisable type parameters in type definitions Changes type of type parameters in outcometree.mli. (Jacques Garrigue, review by Richard Eisenberg)
  • #12897: Fix locking bugs in Runtime_events (Gabriel Scherer and Thomas Leonard, review by Olivier Nicole, Vincent Laviron, and Damien Doligez, report by Thomas Leonard)

  • #12851: Fix race between runtime events teardown and event emission (Olivier Nicole, review by Miod Vallat and Gabriel Scherer)

  • #12860: Fix an assertion that wasn't taking into account the possibility of an ephemeron pointing at static data (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #12861: Fix a possible crash in the threads library (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11040, #12894: Silence false data race observed between caml_shared_try_alloc and oldify. Introduces macros to call TSan annotations which help annotate a "happens before" relationship. (Hari Hara Naveen S and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

  • #12919: Fix register corruption in caml_callback2_asm on s390x. (Miod Vallat, review by Gabriel Scherer)

  • #12924, #12930: Rework package constraint checking to improve interaction with immediacy (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and Richard Eisenberg)

  • #12969: Fix a data race in caml_darken_cont (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12971, #12974: Fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #13019: Remove linking instructions for the Unix library from threads.cma. (This was done for threads.cmxa in OCaml 3.11.) Eliminates warnings from new LLD when using threads.cma of duplicated libraries. (David Allsopp, review by Nicolás Ojeda Bär)

  • #13058: Add TSan instrumentation to caml_call_gc(), since it may raise exceptions. (Fabrice Buoro, Olivier Nicole, Gabriel Scherer, and Miod Vallat)

  • #13079: Save and restore frame pointer across Iextcall on ARM64 (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat)

  • #13094: Fix undefined behavior of left-shifting a negative number (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär)

  • #13130: Minor fixes to Pprintast for raw identifiers and local module open syntax for types (Chet Murthy, review by Gabriel Scherer)

The release of OCaml 5.2.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 second beta, this release contains one small compiler-libs printer fix and one configuration tweak.

The full change log for OCaml 5.2.0 is available on GitHub. A short summary of the changes since the second 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.2.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.2.0~rc1+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.2.0~rc1+flambda+nffa ocaml-variants.5.2.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 second beta

  • #13130: Minor fixes to pprintast for raw identifiers and local module open syntax for types. (Chet Murthy, review by Gabriel Scherer)

  • #13100 Fix detection of zstd when compiling with musl-gcc (David Allsopp, review by Samuel Hym)

The ppxlib team is happy to announce the release of ppxlib.0.32.1.

The main feature of this release is of course the support for the upcoming OCaml 5.2 release. Starting with this version you'll be able to use ppx with the latest compiler.

The feature also comes with a small follow up improvement to the 0.32.0 error reporting changes that simplifies how exception thrown from context free rewriting are handled. The errors will now be inserted where the generated code would have been instead of appended to the whole AST. This should lead to a better error reporting from the compiler as it will now report errors in order of their position in the code.

We'd like to thank the OCaml Software Foundation once again as they funded the vast majority of the work for this release.

See full changelog
  • Add support for OCaml 5.2

  • Insert errors from caught located exceptions in place of the code that should have been generated by context-free rules. (#472, @NathanReb)

Odoc 2.4.2

We've released odoc 2.4.2 with OCaml 5.2 compatibility and a few bug fixes.

See full changelog

Added

  • OCaml 5.2.0 compatibility (@Octachron, #1094, #1112)

Fixed

  • Fix issues #1066 and #1095 with extended opens (@jonludlam, #1082, #1100)

We've released OCamlFormat 0.26.2 with compatibility with OCaml 5.2.

See full changelog

Changed

  • Compatible with OCaml 5.2.0 (#2510, @gpetiot, @Julow)

Dune 3.15.2

We just released version 3.15.2 with some bug fixes.

This one is particularly important for Coq users since it fixes a bug introduced in 3.13.0 that made incremental builds very slow.

See full changelog

Fixed

  • If no directory targets are defined, then do not evaluate enabled_if (#10442, @rgrinberg)

  • Fix a bug where Coq projects were being rebuilt from scratch each time the dependency graph changed. (#10446, fixes #10149, @alizter)

Last week, we merged an update to the compiler-libs "shape" API for querying definition information from the compiler.

Unfortunately, this small change of API breaks compatibility with at least odoc. Generally, we try to avoid this kind of changes during the beta releases of the compiler. However, after discussions we concluded that it will be easier on the long term to fix the API right now in order to avoid multiplying the number of supported versions of the shape API in the various OCaml developer tools .

We have thus released a second beta version of OCaml 5.2.0 to give the time to developer tools to update their 5.2.0 version ahead of the release (see below for the installation instructions).

Beyond this changes of API, the new beta contains three more bug fixes and three documentation updates, which is a good sign in term of stability.

As usual, you can follow the last remaining compatibility slags on the opam readiness for 5.2.0 meta-issue.

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

Currently, the release is planned for the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.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.2.0~beta2

The source code for the beta 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.2.0~beta2+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.2.0~beta2+flambda+nffa ocaml-variants.5.2.0~beta2+options ocaml-option-flambda ocaml-option-no-flat-float-array

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

See full changelog

Compiler-libs API Changes

  • #13001: do not read_back entire shapes to get aliases' uids when building the usages index (Ulysse Gérard, review by Gabriel Scherer and Nathanaëlle Courant)

Bug Fixes

  • #13058: Add TSan instrumentation to caml_call_gc(), since it may raise exceptions. (Fabrice Buoro, Olivier Nicole, Gabriel Scherer and Miod Vallat)

  • #13079: Save and restore frame pointer across Iextcall on ARM64 (Tim McGilchrist, review by KC Sivaramakrishnan and Miod Vallat)

  • #13094: Fix undefined behavior of left-shifting a negative number. (Antonin Décimo, review by Miod Vallat and Nicolás Ojeda Bär)

Documentation Updates

  • #13078: update Format tutorial on structural boxes to mention alignment questions. (Edwin Török, review by Florian Angeletti)

  • #13092: document the existence of the [@@poll error] built-in attribute (Florian Angeletti, review by Gabriel Scherer)

  • #13066, update OCAMLRUNPARAM documentation for the stack size parameter l (Florian Angeletti, review by Nicolás Ojeda Bär, Tim McGilchrist, and Miod Vallat)

MDX 2.4.1

This release reverts the change introduce in Mdx 2.4.0 that allows the execution of included OCaml code blocks after users reported issues. We will revisit the feature to ensure it is opt-in and doesn't break users setup.

See full changelog

Changed

  • Revert #446: "Allow execution of included OCaml code blocks" (#451, @gpetiot). Included OCaml code blocks preserve their pre-2.4.0 behavior.

Feedback on this post is welcomed on Discuss!

We are indescribably thrilled to announce the second beta release of opam 2.2.0.

It contains everything required to be able to make opam-repository compatible with Windows, as well as a whole bunch of fixes. You can view the full list of changes in the release note.

We'll post another blog post very soon with more directions on how to test opam on Windows with this release.

This version is a beta, we invite users to test it to spot previously unnoticed bugs as we head towards the stable release.

Changes

Windows support

This beta introduces a handful of changes necessary to be able to make the default opam-repository support Windows out of the box:

  • Add a new sys-ocaml-system init default global eval variable
  • Hijack the "%{var?string-if-true:string-if-false-or-undefined}%" syntax to support extending the variables of packages with + in their name (conf-c++ and conf-g++ already exist) using "%{?pgkname:var:}%"
  • Add winsymlinks:native to the CYGWIN environment variable when installing a package on Windows. In particular, this provides a workaround when extracting ocamlbuild's sources.
  • Internal Cygwin installation's bin directory is placed as far down PATH as is necessary not to shadow bash, tar, sort or git
  • Disable ACL in Cygwin internal install to avoid permission mismatch errors

We expect to be able to show the proposed changed to opam-repository very soon to take advantage of all these changes.

opam-repository scalability

The current draft resolution resulting from the discussion in ocaml/opam-repository#23789 about the scalability of opam-repository includes the removal of some packages. However currently, opam uses the patch system command to apply changes from a repository. The behaviour of that command is thus very important and it is a known behaviour for the macOS and BSDs patch command to not be able to delete files which leads to failures and inconsistencies for opam. Package managers on those platforms installing opam already make opam depend on GNU patch, however a certain number of people do not install opam via a system package manager (e.g. our own install script!) and end up using their system version of patch. This is in particular a problem on macOS as the name of the GNU patch command is not gpatch like on BSDs but simply patch when installed via Homebrew.

This issue is surprisingly tricky to fix, and after many trials and errors, we've decided to:

  • Warn if GNU patch is not detected when a patch is applied
  • Use gpatch by default instead of patch on NetBSD and DragonFlyBSD
  • Use gpatch if it exists and is detected as GNU patch when patch is not GNU patch

These changes will make their way to the upcoming opam 2.1.6, in a few weeks.

Other noteworthy changes

  • Recommend enabling Developer Mode on Windows. This allows the creation of symlinks without requiring elevation. Longer-term, the aim is that we should never require Developer Mode, but at the moment more things work with it than without it!
  • Mark the internal Cygwin installation as recommended. Please don't try to maintain your own Cygwin install for use with opam unless you really know what you're doing!
  • Fix MSYS2 support. For 2.2.0, the focus has been on Cygwin, so configuring opam to use MSYS2 is quite manual. Please note that even if opam can use a MSYS2 installation, it is not yet officially supported and opam repository is not yet MSYS2 compatible. Use opam with MSYS2 only if you really really know what you're doing!
  • Fix issues when using fish
  • Improve the internal Cygwin installation during init on Windows
  • Unixify Windows paths in init shells scripts
  • Disable Software Heritage fallback by default as there currently no CI job in opam-repository to check validity of proposed swhid regarding release archive (neither publication tools support) and some concerns were raised regarding the degree of trust of the hashing method used by Software Heritage (sha1).
  • Make sure opam source --dev with git sources, clones the whole repository instead of using --depth=1
  • Sandbox: Mark the user temporary directory (as returned by getconf DARWIN_USER_TEMP_DIR) as writable when TMPDIR is not defined on macOS
  • Add Warning 69: Warn for new syntax when package name in variable in string interpolation contains several '+' (this is related to the "hijack" item above)
  • Add support for Wolfi OS, treat it like Alpine family as it also uses apk
  • Upgrade the vendored dune package to 3.14.2 to allow to compile opam when the environment contains unicode characters on Windows (in particular, this means opam now works if your username contains accented characters)
  • Upgrade other vendored packages (cmdliner 1.2.0, re 1.11.0, ocamlgraph 2.1.0, opam-file-format 2.1.6)

Various other general and performance improvements were made and bugs were fixed. API changes are denoted in the release note. This release also includes PRs improving the documentation and improving and extending the tests.

Windows Support

As we've said above we're writing a separate blog post to present how to test this new release of opam on Windows.

Stay tuned!

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~beta2"
    

    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.

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

Dune 3.15.0

We're happy to announce that Dune 3.15.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Removal of previous limitations in many forms

Prior to Dune 3.15 there were a number of limitations where percent forms like %{env:...} could be used to expand to useful values. In this release, @rgrinberg put some effort to relax a lot of these restrictions where possible.

In the new version some of these limitations have been lifted, so for example {env:...} can be used in install stanzas (#10160).

Likewise there was no consistency where %{cma:...} or %{cmo:...} could be used. With #10169, these forms should work consistently everywhere.

Similarly the variables allowed in enabled_if fields have been expanded in #10250, from just allowing variables that can be computed from the context to now allowing all variables as long as expanding these variables does not introduce dependency cycles.

These relaxed rules can also be combined to enable a library depending on environment variables, e.g. (enabled_if %{env:ENABLE_LIBFOO=false})).

Overlapping names in different contexts

Continuing the theme of conditionally enabling or disabling code to be built, @jchavarri and @rgrinberg's work on #10220 makes it possible to have overlapping names between executable and melange.emit targets. This can be useful when a name is to be shared in different contexts (e.g. one context with native compilation and one emitting code for the browser).

Properly output UTF-8 encoded text when formatting

Dune does not assume an encoding of dune files, however when files were formatted the formatter would err on the safe side and escape bytes outside the ASCII range. This means that UTF-8 characters outside of ASCII would get escaped into decimal escape sequences.

This was especially annoying in places where the user would write natural language texts, which is common when defining Opam packages in dune-project files. For example a discussion of a paper by Paul Erdős, Peter Frankl, Vojtěch Rödl would upon reformatting be turned into Paul Erd\197\145s, Peter Frankl, Vojt\196\155 R\195\182, which does a disservice to these scientists and is hard to read.

Thanks to the work of @moyodiallo in #9728 starting with Dune 3.15 the original encoding will be preserved, so your package descriptions will be more readable.

See full changelog

Added

  • Add link flags to to ocamlmklib for ctypes stubs (#8784, @frejsoya)

  • Remove some unnecessary limitations in the expansions of percent forms in install stanza. For example, the %{env:..} form can be used to select files to be installed. (#10160, @rgrinberg)

  • Allow artifact expansion percent forms (%{cma:..}, %{cmo:..}, etc.) in more contexts. Previously, they would be randomly forbidden in some fields. (#10169, @rgrinberg)

  • Allow %{inline_tests} in more contexts (#10191, @rgrinberg)

  • Remove limitations on percent forms in the (enabled_if ..) field of libraries (#10250, @rgrinberg)

  • Support dialects in dune describe pp (#10283, @emillon)

  • Allow defining executables or melange emit stanzas with the same name in the same folder under different contexts. (#10220, @rgrinberg, @jchavarri)

Fixed

  • coq: Delay Coq rule setup checks so OCaml-only packages can build in hybrid Coq/OCaml projects when coqc is not present. Thanks to @vzaliva for the test case and report (#9845, fixes #9818, @rgrinberg, @ejgallego)

  • Fix conditional source selection with select on bigarray in OCaml 5 (#10011, @moyodiallo)

  • melange: fix inconsistency in virtual library implementation. Concrete modules within a virtual library can now refer to its virtual modules too (#10051, fixes #7104, @anmonteiro)

  • melange: fix a bug that would cause stale import paths to be emitted when moving source files within (include_subdirs ..) (#10286, fixes #9190, @anmonteiro)

  • Dune file formatting: output utf8 if input is correctly encoded (#10113, fixes #9728, @moyodiallo)

  • Fix expanding dependencies and locks specified in the cram stanza. Previously, they would be installed in the context of the cram test, rather than the cram stanza itself (#10165, @rgrinberg)

  • Fix bug with dune exec --watch where the working directory would always be set to the project root rather than the directory where the command was run (#10262, @gridbugs)

  • Regression fix: sign executables that are promoted into the source tree (#10263, fixes #9272, @emillon)

  • Fix crash when decoding dune-package for libraries with (include_subdirs qualified) (#10269, fixes #10264, @emillon)

Changed

  • Remove the --react-to-insignificant-changes option. (#10083, @rgrinberg)

MDX 2.4.0

We are happy to announce the release of MDX 2.4.0! This is the first release of MDX to be compatible with OCaml 5.2.

This release also comes with support for executing included OCaml code blocks.

See full changelog

Added

  • Handle the error-blocks syntax (#439, @jonludlam, @gpetiot)
  • Allow execution of included OCaml code blocks. Add skip to include blocks to revert to the old behavior (#446, @panglesd, @gpetiot) Warning: this is a breaking change that is reverted in the next release.
  • Make MDX compatible with OCaml 5.2 (#448, @gpetiot)

Fixed

  • Reduce false-positives while detecting warnings (#440, @Julow)

Nearly two months after the first alpha release, the release of OCaml 5.2.0 is drawing near.

We have thus released a first beta version of OCaml 5.2.0 to help you update your softwares and libraries ahead of the release (see below for the installation instructions).

Compared to the alpha release, this beta contains a majority of runtime system fixes, and a handful of other fixes across many subsystems.

Overall, the opam ecosystem looks in a good shape for the first beta release. Most core development tools support OCaml 5.2.0, and you can follow the last remaining wrinkles on the opam readiness for 5.2.0 meta-issue.

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

Currently, the release is planned for the end of April or the beginning of May.

If you are interested in full list of features and bug fixes of the new OCaml version, the updated change log for OCaml 5.2.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.2.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.2.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.2.0~beta1+flambda+nffa ocaml-variants.5.2.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 Fixes

  • #12875, #12879, #12882: Execute preemptive systhread switching as a delayed pending action. This ensures that one can reason within the FFI that no mutation happens on the same domain when allocating on the OCaml heap from C, consistently with OCaml 4. This also fixes further bugs with the multicore systhreads implementation. (Guillaume Munch-Maccagnoni, bug reports and suggestion by Mark Shinwell, review by Nick Barnes and Stephen Dolan)

  • #12876: Port ThreadSanitizer support to Linux on POWER (Miod Vallat, review by Tim McGilchrist)

  • #12678, #12898: free channel buffers on close rather than on finalization (Damien Doligez, review by Jan Midtgaard and Gabriel Scherer, report by Jan Midtgaard)

  • #12915: Port ThreadSanitizer support to Linux on s390x (Miod Vallat, review by Tim McGilchrist)

  • #12914: Slightly change the s390x assembly dialect in order to build with Clang's integrated assembler. (Miod Vallat, review by Gabriel Scherer)

  • #12897: fix locking bugs in Runtime_events (Gabriel Scherer and Thomas Leonard, review by Olivier Nicole, Vincent Laviron and Damien Doligez, report by Thomas Leonard)

  • #12860: Fix an assertion that wasn't taking into account the possibility of an ephemeron pointing at static data. (Mark Shinwell, review by Gabriel Scherer and KC Sivaramakrishnan)

  • #11040, #12894: Silence false data race observed between caml_shared_try_alloc and oldify. Introduces macros to call tsan annotations which help annotate a ``happens before'' relationship. (Hari Hara Naveen S and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

  • #12919: Fix register corruption in caml_callback2_asm on s390x. (Miod Vallat, review by Gabriel Scherer)

  • #12969: Fix a data race in caml_darken_cont (Fabrice Buoro and Olivier Nicole, review by Gabriel Scherer and Miod Vallat)

Standard Library Fix

  • #12677, #12889: make Domain.DLS thread-safe (Gabriel Scherer, review by Olivier Nicole and Damien Doligez, report by Vesa Karvonen)

Type System Fix

  • #12924, #12930: Rework package constraint checking to improve interaction with immediacy (Chris Casinghino and Florian Angeletti, review by Florian Angeletti and Richard Eisenberg)

Compiler User-Interface Fix

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

Build System Fixes

  • #12198, #12321, #12586, #12616, #12706, +#13048: continue the merge of the sub-makefiles into the root Makefile started with #11243, #11248, #11268, #11420 and #11675. (Sébastien Hinderer, review by David Allsopp and Florian Angeletti)

  • #12768, +#13030: Detect mingw-w64 coupling with GCC or LLVM, detect clang-cl, and fix C compiler feature detection on macOS. (Antonin Décimo, review by Miod Vallat and Sébastien Hinderer)

  • #13019: Remove linking instructions for the Unix library from threads.cma (this was done for threads.cmxa in OCaml 3.11). Eliminates warnings from new lld when using threads.cma of duplicated libraries. (David Allsopp, review by Nicolás Ojeda Bär)

  • #12758, +#12998: Remove the Marshal.Compression flag to the Marshal.to_* functions. The compilers are still able to use ZSTD compression for compilation artefacts. This is a forward port and clean-up of the emergency fix that was introduced

Compiler Internals Fix

  • #12389, #12544, #12984, +#12987: centralize the handling of metadata for compilation units and artifacts in preparation for better unicode support for OCaml source files. (Florian Angeletti, review by Vincent Laviron and Gabriel Scherer)

We have the pleasure of celebrating the birthday of Grace Chisholm Young by announcing the release of OCaml version 4.14.2.

This release is a collection of safe bug fixes, cherry-picked from the OCaml 5 branch. If you are still using OCaml 4.14 and cannot yet upgrade to OCaml 5, this release is for you.

The 4.14 branch is expected to receive updates for at least one year, while the OCaml 5 branch is stabilising.

Thus don't hesitate to report any bugs on the OCaml issue tracker.

See the list of changes below for more details.


Installation Instructions

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

opam update
opam switch create 4.14.2

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

See full changelog

Changes in OCaml 4.14.2 (14 March 2024)

Runtime system:

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

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build system:

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

  • #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)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

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

  • #12878: fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: fix an uncaught Ctype.Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: bugfix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialization of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, && and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

  • #12116, #12993: explicitly build non PIE executables on x86 32bits architectures (Florian Angeletti, review by David Allsopp)

  • #13018: Don't pass duplicate libraries to the linker when compiling ocamlc.opt and when using systhreads (new versions of lld emit a warning). (David Allsopp, review by Nicolás Ojeda Bär)

Dune 3.14.2

We're happy to announce that Dune 3.14.2 is now available.

Note that due to a regression that was detected before publishing to opam version 3.14.1 should not be used. The fix for the regression is part of this release.

This feature brings some small bugfixes around the handling of Coq as well as solves an issue where Dune is running on Windows in a path that contains Unicode characters. This affected e.g. users with diacritics or non-latin script in their name when running Dune within their home directory.

See full changelog

Fixed

  • When a directory is changed to a file, correctly remove it in subsequent dune build runs. (#9327, fix #6575, @emillon)

  • Fix a problem with the doc-new target where transitive dependencies were missed during compile. This leads to missing expansions in the output docs. (#9955, @jonludlam)

  • coq: fix performance regression in coqdep unescaping (#10115, fixes #10088, @ejgallego, thanks to Dan Christensen for the report)

  • coq: memoize coqdep parsing, this will reduce build times for Coq users, in particular for those with many .v files (#10116, @ejgallego, see also #10088)

  • on Windows, use an unicode-aware version of CreateProcess to avoid crashes when paths contains non-ascii characters. (#10212, fixes #10180, @emillon)

  • fix compilation on non-glibc systems due to signal.h not being pulled in spawn stubs. (#10256, @emillon)

The release of OCaml version 4.14.2 is imminent.

OCaml 4.14.2 is a new update to the stable 4.14 branch of OCaml. This new release backports many safe bug fixes from the OCaml 5 branch and fixes a handful of compatibility issues of OCaml 4.14.1 with newer operating system versions.

A full list of bug fixes is available below.

In order to ensure that the future release works as expected, we are planning to test a release candidate during the upcoming week.

If you find any bugs, please report them here 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 4.14.2~rc1

The source code for the release candidate is 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.4.14.2~rc1+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 4.14.2~rc1+flambda+nffa ocaml-variants.4.14.2~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 OCaml 4.14.1

Runtime System:

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

  • #11763, #11759, #11861, #12509, #12577: Use strict prototypes on primitives. (Antonin Décimo, review by Xavier Leroy, David Allsopp, Sébastien Hinderer and Nick Barnes)

  • (breaking change) #10723: Do not use -flat-namespace linking for macOS. (Carlo Cabrera, review by Damien Doligez)
  • #11332, #12702: Make sure Bool_val(v) has type bool in C++ (Xavier Leroy, report by ygrek, review by Gabriel Scherer)

Build System:

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

  • #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)

  • #12903: Disable control flow integrity on OpenBSD >= 7.4 to avoid illegal instruction errors on certain CPUs. (Michael Hendricks, review by Miod Vallat)

Bug fixes:

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

  • #12878: Fix incorrect treatment of injectivity for private recursive types. (Jeremy Yallop, review by Gabriel Scherer and Jacques Garrigue)

  • #12971, #12974: Fix an uncaught Ctype. Escape exception on some invalid programs forming recursive types. (Gabriel Scherer, review by Florian Angeletti, report by Neven Villani)

  • #12264, #12289: Fix compact_allocate to avoid a pathological case that causes very slow compaction. (Damien Doligez, report by Arseniy Alekseyev, review by Sadiq Jaffer)

  • #12513, #12518: Automatically enable emulated fma for Visual Studio 2019+ to allow configuration with either pre-Haswell/pre-Piledriver CPUs or running in VirtualBox. Restores parity with the other Windows ports, which don't require explicit --enable-imprecise-c99-float-ops. (David Allsopp, report by Jonah Beckford and Kate Deplaix, review by Sébastien Hinderer)

  • #11633, #11636: Bug fix in caml_unregister_frametable (Frédéric Recoules, review by Gabriel Scherer)

  • #12636, #12646: More prudent reinitialisation of I/O mutexes after a fork() (Xavier Leroy, report by Zach Baylin, review by Enguerrand Decorne)

  • (breaking change) #10845 Emit frametable size on AMD64 BSD (OpenBSD, FreeBSD, NetBSD) systems (emitted for Linux in #8805) (Hannes Mehnert, review by Nicolás Ojeda Bär)
  • #12958: Fix tail-modulo-cons compilation of try-with, &&, and || expressions. (Gabriel Scherer and Nicolás Ojeda Bär, report by Sylvain Boilard, review by Gabriel Scherer)

Utop 2.14.0

This release of UTop 2.14.0 brings support for the upcoming version of the compiler, OCaml 5.2.

See full changelog
  • Add support for OCaml 5.2 (#470, fixes #466, @leostera, @ManasJayanth, @huwaireb)

We're thrilled to announce the release of Merlin 4.14, a significant update that introduces a suite of enhancements and fixes to improve your OCaml editor experience.

In addition to the improvements and bug fixes in this release, Merlin 4.14 is the first version to support the upcoming OCaml 5.2 compiler.

Some highlights in this release include:

  • Improved Telemetry and Heap Usage Reporting: With the addition of the "heap_mbytes" field in server responses (#1717) and cache stats in telemetry (#1711), developers can now gain deeper insights into Merlin's performance and memory usage. These enhancements are part of our ongoing efforts to improve Merlin's performance profiling capabilities.
  • SyntaxDocument Command: Addressing a common challenge among new users, the new SyntaxDocument command (#1706) enables you to find detailed information about the syntax element under the cursor directly from your editor. This feature aims to facilitate learning and code readability by providing instant access to syntax descriptions, making it easier for developers to familiarize themselves with OCaml's syntax.

Happy coding!

See full changelog
  • merlin binary
    • Add a "heap_mbytes" field to Merlin server responses to report heap usage (#1717)
    • Add cache stats to telemetry (#1711)
    • Add new SyntaxDocument command to find information about the node under the cursor (#1706)
    • Fix FLG -pp ppx.exe -as-pp/-dump-ast use of invalid shell redirection when direct process launch on Windows. (#1723, fixes #1722)
    • Add a query_num field to the ocamlmerlin responses to detect server crashes (#1716)
    • Jump to cases within a match statement (#1726)
    • Jump to module-type (#1728, partially fixes #1656)
    • Exposes stable functions for configuration handling and pattern variable destruction. (#1730)
  • editor modes
    • vim: load merlin under the ocamlinterface and ocamllex filetypes (#1340)
    • Fix merlinpp not using binary file open (#1725, fixes #1724)

Dune 3.14.0

We're happy to announce that Dune 3.14.0 is now available. This feature has many fixes and new features that you can find in the changelog.

There are a few new features that we would like to specially highlight.

Dynamic dune files with (dynamic_include)

It is common for some parts of a build to be dynamic: for example a source file can be generated, or some parts of the configuration like C flags can be generated from a Dune rule. But until now it was not possible to generate rules dynamically.

For example, one might want to do it is to set up one rule per input file. This is a common pattern in test suites and is easy to do with Make. But Dune does not have a concept of parameterized rules, so it is necessary to set up one rule per input file.

The pattern to do this with Dune is to:

  • Write a generator that lists the input files and emits Dune stanzas (as text);
  • Add a rule that makes a dune.inc file using this generator;
  • Add (include dune.inc) in the main dune file,

However, this requires checking in the generated dune.inc file in the repository. Another drawback is that when modifying the list of input files, it is necessary to run tests twice: one to update dune.inc, one to run the new test.

This release of Dune adds a new (dynamic_include) stanza that lifts these restrictions: dune.inc does not have to be part of the source tree, it can be generated transparently. This comes with some restrictions: some stanzas can not be generated, in particular the ones that define public libraries. And due to how rule loading works, the generated stanza needs to be defined in a different directory.

Still, this should be useful for many users that rely on the generate-include-commit pattern described above.

Sherlodoc integration

Sherlodoc is a search engine for OCaml documentation, which supports search by name, documentation and fuzzy type search (similar to Hoogle in the Haskell world). It can be obtained from opam using opam install sherlodoc.

When it is available, Dune commands that produce HTML documentation, such as dune build @doc and dune build @doc-new, will include a search bar in the generated output.

See full changelog

Added

  • Introduce a (dynamic_include ..) stanza. This is like (include foo) but allows foo to be the target of a rule. Currently, there are some limitations on the stanzas that can be generated. For example, public executables, libraries are currently forbidden. (#9913, @rgrinberg)

  • Introduce $ dune promotion list to print the list of available promotions. (#9705, @moyodiallo)

  • If Sherlodoc is installed, add a search bar in generated HTML docs (#9772, @EmileTrotignon)

  • Add only_sources field to copy_files stanza (#9827, fixes #9709, @jchavarri)

  • The (foreign_library) stanza now supports the (enabled_if) field. (#9914, @nojb)

Fixed

  • Fix $ dune install -p incorrectly recognizing packages that are supposed to be filtered (#9879, fixes #4814, @rgrinberg)

  • subst: correctly handle opam files in opam/ subdirectory (#9895, fixes #9862, @emillon)

  • Odoc private rules are not set up if a library is not available due to enabled_if (#9897, @rgrinberg and @jchavarri)

Changed

  • When dune language 3.14 is enabled, resolve the binary in (run %{bin:..} ..) from where the binary is built. (#9708, @rgrinberg)

  • boot: remove single-command bootstrap. This was an alternative bootstrap strategy that was used in certain conditions. Removal makes the bootstrap a bit slower on Linux when only a single core is available, but bootstrap is now reproducible in all cases. (#9735, fixes #9507, @emillon)

The ppxlib dev team is happy to announce the release of ppxlib.0.32.0.

The main feature of this release, implemented by @burnleydev1 during their Outreachy internship, is a huge improvement of the handling of located exceptions raised by ppx-es. Whenever a rewrite of the AST throws such an exception, the ppxlib driver catches it and resumes the rewriting using the latest valid AST it knows of. All caught exceptions are appended to the final AST as [%%ocaml.error ..] nodes. This means the driver returns a valid AST instead of one composed of a single error node corresponding to the first raised exception. This leads to a much better experience for ppx users as merlin now has a valid AST to work with when this happens, allowing it to properly function, reporting all errors, from ppx-es or otherwise. Note that despite this change we still recommend ppx authors to embed errors in the rewritten AST rather than throw exceptions.

The release also comes with a few bug fixes on longident parsing or windows compatibility and a new simplified API for ppx authors using attributes as flags (i.e. attributes without payloads such as [@ignore] for instance).

We'd like to thank our external contributors for this release:

  • @burnleydev1 for their improvement of the driver exception handling
  • @dianaoigo for their addition of the new attribute flags API
  • @jonahbeckford for their fix of the windows compatibility

We'd also like to thank the OCaml Software Foundation who has been funding my work on this release.

See full changelog
  • Add an optional embed_errors argument to Context_free.map_top_down that controls how to deal with exceptions thrown by context-free rules. (#468, @NathanReb)

  • Fix Longident.parse so it properly handles unparenthesized dotted operators such as +. or *.. (#111, @rgrinberg, @NathanReb)

  • raising an exception does no longer cancel the whole context free phase(#453, @burnleydev1)

  • Sort embedded errors that are appended to the AST by location so the compiler reports the one closer to the beginning of the file first. (#463, @NathanReb)

  • Update Attribute.get to ignore loc_ghost. (#460, @ceastlund)

  • Add API to manipulate attributes that are used as flags (#408, @dianaoigo)

  • Update changelog to use ISO 8061 date format: YYYY-MM-DD. (#445, @ceastlund)

  • Replace Caml with Stdlib. (#427, @ceastlund)

  • When a transformation raises, the last valid AST is used as input to the upcoming transformations. All such errors are collected and appended as extension nodes to the final AST (#447, @burnleydev1)

  • Fix a small mistake in the man pages: Embededding errors is done by default with -as-pp, not with -dump-ast (#464, @pitag-ha)

  • Set appropriate binary mode when writing to stdout especially for Windows compatibility. (#466, @jonahbeckford)

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

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

The progresses on stabilising the ecosystem are tracked on the opam readiness for 5.2.0 meta-issue. The full release is expected around April.

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.2.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 and later:

opam update
opam switch create 5.2.0~alpha1

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

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

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.2.0~alpha1+options <option_list>

where option_list is a space separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.2.0~alpha1+flambda+nffa ocaml-variants.5.2.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

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

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

In both cases, all available options can be listed with opam search ocaml-option.

Dune 3.13.1

We just released version 3.13.1 with some bugfixes.

See full changelog
  • Fix performance regression for incremental builds (#9769, fixes #9738, @rgrinberg)

  • Fix dune ocaml top-module to correctly handle absolute paths. (#8249, fixes #7370, @Alizter)

  • subst: ignore broken symlinks when looking at source files (#9810, fixes #9593, @emillon)

  • subst: do not fail on 32-bit systems when large files are encountered. Just log a warning in this case. (#9811, fixes #9538, @emillon)

  • boot: sort directory entries in readdir. This makes the dune binary reproducible in terms of filesystem order. (#9861, fixes #9794, @emillon)

If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.