OCaml Changelog

RSS

Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure and the OCaml Platform Tools.

We have the pleasure of celebrating the birthdays of Camille Saint-Saëns and Karl Schwarzschild by announcing the release of OCaml version 5.4.0.

Some of the highlights of OCaml 5.4.0 are:

Labelled tuples

It is now possible to put labels on tuple fields

let ( * ) (x,~dx) (y,~dx:dy) = x*.y, ~dx:(x *. dy +. y *. dx )

Those labeled tuples are equivalent to SML records: they are an order-dependent and structurally-typed variants of records. They are mostly intended for local types.

Array literal syntax support for immutable arrays and floatarrays

The array literal syntax is now shared by array-like primitive datatypes, like 'a array, floatarray and immutable array iarray. For instance, this code

let x =
  let x = Array.Flotarray.create 3 in
  Array.Flotarray.set x 0 1.;
  Array.Flotarray.set x 1 2.;
  Array.Flotarray.set x 2 3.;
  x

can now be written

let x : floatarray = [|0.; 1.; 2.|]

This also supported in patterns

let one = match x with
  | [|_;y;_|] -> Some y
  | _ -> None

However array indexing still needs to go through user-defined indexing operator

let (.$()) = Array.Floatarray.get
let (.$()<-) = Array.Floatarray.set
let () = x.$(0) <- x.$(1)

Immutable arrays

Along with shared array literals, OCaml 5.4 adds support for immutable arrays.

let v: int iarray = [| 0; 1; 2 |]

Immutable arrays are covariant in the type of their elements, it is thus possible to coerce immutable arrays with no costs at runtime:

let i1: _ iarray = [|object method m = 0 end|]
let i2 = ( i1 :> < > iarray)

Atomic record fields

It is now possible to mark a field of a record as atomic. Atomic operations on those fields require to use the new Atomic.Loc submodule after accessing the location of those fields with the [%atomic.loc ...] builtin extension. For instance,

type 'a mpsc_list = { mutable head:'a list; mutable tail: 'a list [@atomic] }

let rec push t x =
  let before = Atomic.Loc.get [%atomic.loc t.tail] in
  let after = x :: before in
  if not (Atomic.Loc.compare_and_set [%atomic.loc t.tail] before after) then
    push t x
  ...

Moreover, it is forbidden to pattern match on atomic fields:

let f { head; tail } = tail;;
Error: Atomic fields (here tail) are forbidden in patterns,
      as it is difficult to reason about when the atomic read
      will happen during pattern matching: the field may be read
      zero, one or several times depending on the patterns around it.

in order to make all reads explicit.

Four new standard library modules: Pair, Pqueue, Repr, and Iarray

The standard library has been extended with four new modules:

  • Pair: functions for working on pairs
let ones = Pair.map_fst succ (0,1)
  • Pqueue: priority queues, generic or not
module Int_pqueue = Pqueue.MakeMin(Int)
let q = Int_pqueue.of_list [4;0;5;7]
let some_zero = Int_pqueue.pop_min q
  • Repr: physical and structural equality, comparison function, more generically all functions dependent on the memory representation of values.
let f = Repr.phys_equal (ref 0) (ref 0)
  • Iarray: functions on immutable arrays
let a = Iarray.init 10 Fun.id
let b = Iarray.map succ a

Restored "memory cleanup upon exit" mode

This mode allows to restart many time the OCaml runtime in C-driven programs that interact with OCaml libraries. It is also useful to reduce noise when tracking memory leaks in C code running the OCaml runtime. To get around cancellation issues, the restored mode currently assume that all domains are joined before exiting the OCaml runtime.

A new section in the reference manual on profiling OCaml programs on Linux and macOS

A new section in the reference manual explains how to use OS specific profiling tools to profile native OCaml programs.

A lot of incremental changes:

  • Many runtime and code generation improvements
  • More than thirty new standard library functions
  • Nearly a dozen improved error messages
  • Around fifty bug fixes

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 full changelog.


Installation Instructions

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

opam update
opam switch create 5.4.0

The source code for the release 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.4.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.4.0+flambda+nffa ocaml-variants.5.4.0+options ocaml-option-flambda ocaml-option-no-flat-float-array
See full changelog

Language features:

  • #13097: added immutable arrays ('a iarray type, Iarray stdlib module) (Antal Spector-Zabusky and Olivier Nicole, review by Gabriel Scherer, Jeremy Yallop and Vincent Laviron)

  • #13340: Array literal syntax [| e1; ...; en |] can now be used to denote values of type 'a array and 'a iarray and floatarray, both in expressions and patterns. The compiler disambiguates each case by using contextual type information (assuming 'a array by default). (Nicolás Ojeda Bär, review by Richard Eisenberg, Jeremy Yallop, Jacques Garrigue, and Gabriel Scherer)

  • #13498: Tuple fields are now optionally labeled: (x:42, y:0) and let (~x, ~y) = ... in .... (Ryan Tjoa and Chris Casinghino, review by Gabriel Scherer, Chris Casinghino, and Leo White)

  • RFCs#39, #13404: atomic record fields { ...; mutable readers : int [@atomic]; ... } Atomic.Loc.fetch_and_add [%atomic.loc data.readers] 1 (Clément Allain and Gabriel Scherer, review by KC Sivaramakrishnan, Basile Clément and Olivier Nicole)

Standard library:

  • (breaking change) #14124: Do not raise Invalid_argument on negative List.{drop,take}. (Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär)
  • #13696: Add Result.product and Result.Syntax: let open Result.Syntax in let* x = ... in ... (Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär)

  • #12871: Add the Pqueue module to the stdlib. It implements priority queues. (Jean-Christophe Filliâtre, review by Daniel Bünzli, Léo Andrès and Gabriel Scherer)

  • #13760: Add String.{edit_distance,spellcheck} (Daniel Bünzli, review by wikku, Nicolás Ojeda Bär, Gabriel Scherer and Florian Angeletti)

  • #13753, #13755: Add Stdlib.Repr: Repr.phys_equal and Repr.compare are more explicit than (==) and compare. (Kate Deplaix, Thomas Blanc and Léo Andrès, review by Gabriel Scherer, Florian Angeletti, Nicolás Ojeda Bär, Daniel Bünzli and Jeremy Yallop)

  • #13695: Add Stdlib.Char.Ascii (Daniel Bünzli, review by by Nicolás Ojeda Bär and Jeremy Yallop)

  • #13720: Add Result.{get_ok',error_to_failure} (Daniel Bünzli, review by wikku, Gabriel Scherer, Nicolás Ojeda Bär, Vincent Laviron and hirrolot)

  • #13885: Add Dynarray.{exists2, for_all2}. (T. Kinsart, review by Daniel Bünzli, Gabriel Scherer, and Nicolás Ojeda Bär)

  • (breaking change) #13862: Make List.sort_uniq keep the first occurrences of duplicates. (Benoît Jubin, review by Nicolás Ojeda Bär, Gabriel Scherer)
  • #13836: Add [Float.]Array.{equal,compare}. (Daniel Bünzli, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #13796: Add Uchar.utf_8_decode_length_of_byte and Uchar.max_utf_8_decode_length. (Daniel Bünzli, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #13768: Add Either.get_left and Either.get_right (T. Kinsart, review by Nicolás Ojeda Bär and Florian Angeletti)

  • (breaking change) #13570, #13794: Format, add an out_width function to Format device for approximating unicode width. (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli, and Gabriel Scherer)
  • #13731: Add Either.retract (Daniel Bünzli, review by Nicolás Ojeda Bär and David Allsopp)

  • #13729: Add Seq.filteri (T. Kinsart, review by Nicolás Ojeda Bär and Daniel Bünzli)

  • #13721: Add Result.retract (Daniel Bünzli, review by Gabriel Scherer, Nicolás Ojeda Bär and David Allsopp)

  • #13310: Add Stdlib.Pair (Victoire Noizet, review by Nicolás Ojeda Bär, Daniel Bünzli, Xavier Van de Woestyne, Jeremy Yallop and Florian Angeletti)

  • #13662: Add eager boolean operations Bool.logand, Bool.logor, Bool.logxor (Jeremy Yallop, review by Nicolás Ojeda Bär)

  • #13463, #13572: Avoid raising Queue.empty in Format when it is used concurrently, raise a specific exception instead. (Chritophe Raffalli, review by Gabriel Scherer and Daniel Bünzli)

  • #13620: Avoid copying the string in String.concat, String.sub and String.split_on_char when the full string is returned. (Christophe Raffalli, review by Nicolás Ojeda Bär and Gabriel Scherer and Hugo Heuzard)

  • #13727: Reimplement Sys.getenv_opt not to use exceptions internally, meaning that the current backtrace is preserved when Sys.getenv_opt returns None. (David Allsopp, review by Nicolás Ojeda Bär, Josh Berdine and Gabriel Scherer)

  • #13737: Avoid closure allocations in Weak.Make.add when resizing the table (Vincent Laviron, review by Gabriel Scherer and Daniel Bünzli)

  • #13740: Improve performance of Weak.find_aux (Josh Berdine, review by Gabriel Scherer)

  • #13782: Improve performance and type safety of Type.Id by using [%extension_constructor] instead of Obj.Extension_constructor.of_val. (Basile Clément, review by Vincent Laviron and Nicolás Ojeda Bär)

  • #13589: Expose Sys.io_buffer_size, the size of internal buffers used by the runtime system and the unix library. (Yves Ndiaye and Nicolás Ojeda Bär, review by Daniel Bünzli and Nicolás Ojeda Bär)

  • #13569: add a Format.format_text which adds break hints to format literals. (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli, and Gabriel Scherer)

  • #13578: On Windows, use the OS CSPRNG to seed the Stdlib.Random generator. (Antonin Décimo, review by Miod Vallat, Nicolás Ojeda Bär, and Xavier Leroy)

  • #13859: Fix Weak.get_copy not darkening custom blocks (Josh Berdine, review by Stephen Dolan)

  • #13909: Add Dynarray.unsafe_to_iarray (Olivier Nicole, review by Daniel Bünzli, Stefan Muenzel and Gabriel Scherer, request by Daniel Bünzli)

  • #13932: Add List.singleton and Seq.singleton (David Allsopp, tariffs applied by Nicolás Ojeda Bär and Gabriel Scherer)

  • (breaking change) #13843: Add signal definitions for SIGIO and SIGWINCH. Introduces a type alias for signal int, signal_to_string to convert OCaml signal numbers to their POSIX equivalent names, and signal_of_int/signal_to_int for converting between OCaml and platform signal numbers. (Reported in #13825) (Tim McGilchrist, review by David Allsopp, Nicolás Ojeda Bär, Daniel Bünzli Jan Midtgaard and Miod Vallat)

Runtime system:

  • #13500: Add frame pointers support for ARM64 on Linux and macOS. (Tim McGilchrist, review by KC Sivaramakrishnan, Fabrice Buoro and Miod Vallat)

  • #12964: Reintroduce "memory cleanup upon exit" mode. The cleanup will however be incomplete if not all domains have been joined when the main domain terminates. (Miod Vallat, review by KC Sivaramakrishnan, feedback from Nick Barnes and Gabriel Scherer)

  • #13582: Enable software prefetching support for ARM64, s390x, PPC64 and RiscV. Used during GC marking and sweeping to speed up both operations by prefetching data. (Tim McGilchrist, review by Nick Barnes, Antonin Décimo, Stephen Dolan and Miod Vallat)

  • #13675: Make Unix.map_file memory show up in Gc.Memprof. (Stephen Dolan, review by Guillaume Munch-Maccagnoni and Gabriel Scherer)

  • #13785: Add Runtime_events.Timestamp.get_current. (Simon Cruanes)

  • #13774: Fix for inaccurate live blocks/words stats in compaction. (Sadiq Jaffer, report by KC Sivaramakrishnan and Jan Midtgaard, review by Gabriel Scherer)

  • #13773: Ensure that shared pool owners are correctly set on pool adoption. (Stephen Dolan, review by Sadiq Jaffer and Gabriel Scherer)

  • (breaking change) #11449, #13497: Add caml_stat_char_array_{to,of}_os functions allowing conversion of string data which may contain NUL characters. Correct implementation of caml_stat_strdup_to_utf16 to raise Out_of_memory instead of returning of NULL (the behaviour of caml_stat_strdup_to_os was inconsistent between Unix/Windows). (David Allsopp, review by Nick Barnes, Antonin Décimo and Miod Vallat)
  • #13352: Concurrency refactors and cleanups. (Antonin Décimo, review by Gabriel Scherer, David Allsopp, and Miod Vallat)

  • #13437: Stop using GetProcAddress to load functions that were not available in older, now unsupported Windows versions. (Antonin Décimo, review by Nicolás Ojeda Bär and David Allsopp)

  • #13470: Constify some function parameters, flags tables, and some pointers in C code (take 3). (Antonin Décimo, review by Stephen Dolan and Miod Vallat)

  • #13492: Parse the CAML_LD_LIBRARY_PATH environment variable for the shared_libs_path item in ocamlrun -config in addition to displaying the entries found in ld.conf. (David Allsopp, review by Stephen Dolan)

  • #13496: Add missing .type and .size directives to main frametable to silence warnings from the linker when using libasmrun_shared on amd64 and power. The other backends already carried these directives. (David Allsopp, review by Tim McGilchrist and Miod Vallat)

  • #13354: Use C99 flexible array member syntax everywhere. (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, and Xavier Leroy)

  • #11865, #13584: Fix a deadlock triggered by deleting C roots from C finalisers (Stephen Dolan, report by Timothy Bourke, review by Mark Shinwell and Damien Doligez)

  • #13613: Functions from caml/skiplist.h and caml/lf_skiplist.h no longer raise Out_of_memory exceptions that the runtime could not handle. (Guillaume Munch-Maccagnoni, review by Stephen Dolan)

  • #13575, #13635: Maintain OCaml frame pointers correctly even when using C libraries that do not support them. (Stephen Dolan and David Allsopp, report by Thomas Leonard, review by Tim McGilchrist and Fabrice Buoro)

  • #13643: Allow values reachable from ephemeron keys to be collected by minor GC (Stephen Dolan, review by François Bobot)

  • #13701: optimize caml_continuation_use based on #12735 (Hugo Heuzard, review by KC Sivaramakrishnan)

  • #13227, #13714: Review of locking in the multicore runtime. Fix deadlocks in runtime events and potential deadlocks with named values. (Guillaume Munch-Maccagnoni, review by Gabriel Scherer, tests by Jan Midtgaard)

  • #13736: Fix major GC pacing bug triggered by synchronous collections. (Nick Barnes, review by Damien Doligez and Tim McGilchrist)

  • #13827: Avoid re-marking ephemerons with trivial data. (Stephen Dolan, review by Nick Barnes and Josh Berdine, benchmarking by Nicolás Ojeda Bär)

  • #13300, #13861: introduce Gc.ramp_up to explicitly mark ramp-up phases of memory consumption and avoid GC overwork. Ramp-up behaviors are worse with OCaml 5 than with OCaml 4 due to higher sensitivity to excessive pacing computations. Indicating ramp-up explicitly eliminates the main known slowdown of OCaml 5 (relative to OCaml 4) for Coq/Rocq. (Gabriel Scherer, review by Damien Doligez and Guillaume Munch-Maccagnoni, report by Emilio Jesús Gallego Arias and Olivier Nicole)

  • #14057: Don't update memprof too early at the end of a minor GC. (Nick Barnes, review by Damien Doligez).

Code generation and optimizations:

  • #13262, #14074: fix performance issue on Apple Silicon macOS by emitting stlr instead of dmb ishld; str. (KC Sivaramakrishnan, report by François Pottier, analysis by Frédéric Bour, Xavier Leroy, Miod Vallat, Gabriel Scherer and Stephen Dolan, review by Miod Vallat, Vincent Laviron and Xavier Leroy)
  • (breaking change) #13050, #14104, #14143: Use '$' instead of '.' to separate module names in symbol names on macOS and Windows (including the Cygwin backend). This changes mangling of OCaml identifiers on those operating systems from camlModule.name_NNN to camlModule$name_NNN. Additionally it changes the encoding of special characters from $xx (two hex digits) to $$xx (two dollar signs followed by two hex digits). (Tim McGilchrist, with contributions from Xavier Leroy, reviewed by Xavier Leroy, Miod Vallat, Gabriel Scherer, Nick Barnes and Hugo Heuzard)
  • #13807: Allow unaligned memory accesses on ARM64. (Matthew Else, review by Xavier Leroy)

  • #13565: less tagging in switches compiled to affine transformations by ocamlopt. (Gabriel Scherer and Clément Allain, review by Vincent Laviron, report by Vesa Karvonen)

  • #13672 Avoid register stall on conversion instructions on amd64. (Pierre Chambart, review by Gabriel Scherer and Xavier Leroy, report by Patrick Nicodemus)

  • #13667: (originally #11162) Fix instr_size computation on arm64. (Stephen Dolan and Tim McGilchrist, review by Xavier Leroy and David Allsopp)

  • #13758: Propagate more value kinds in Flambda to allow more unboxing (Vincent Laviron, review by Pierre Chambart)

  • #13759: Propagate more type information from clambda to cmm. (Pierre Chambart, review by Gabriel Scherer)

  • #13735: Follow the behaviour of the C compiler to decide whether to emit the .size and .type directives and the .note.GNU-stack section (Samuel Hym, review by Miod Vallat, Antonin Décimo and Gabriel Scherer)

Other libraries:

  • (breaking change) #13435: On Windows, use system calls for Filename.get_temp_dir_name instead of directly reading the environment, which in particular improves the security of OCaml processes running in the SYSTEM security context by mitigating privileged file operation attacks. For all other processes running with the default environment (where TEMP is set), there is no discernible change. (Antonin Décimo, review by Nicolás Ojeda Bär and David Allsopp)
  • #13504, #13625, #14223: Add Thread.set_current_thread_name. (Romain Beauxis, review by Gabriel Scherer and Antonin Décimo)
  • (breaking change) #13376: Allow Dynlink.loadfile_private to load bytecode libraries with internal dependencies (Vincent Laviron, report by Stéphane Glondu, review by Nicolás Ojeda Bär and Xavier Leroy)
  • #13429: add Unix.sigwait, a binding to the sigwait system call; implement Thread.wait_signal using Unix.sigwait, and Thread.sigmask using Unix.sigprocmask. (Xavier Leroy, review by Antonin Décimo, Gabriel Scherer, Miod Vallat)

  • #13442, #13452: Fix Unix.getgroups for users belonging to more than 32 groups when using musl (Kate Deplaix, review by Gabriel Scherer, Antonin Décimo, Anil Madhavapeddy)

  • #13576: Introduce internal helpers to convert between time representations. On Windows, prevent erroneously waiting for an unbounded time in Unix.select if more than 64 file descriptors per lists are watched, or if watching non-socket file descriptors, and a timeout longer than $2^{32}$ milliseconds is used. Cap the timeout to $2^{32}$ milliseconds. (Antonin Décimo, review by Gabriel Scherer and Miod Vallat)

  • #13921: Set cloexec correctly on CRT file descriptors created by the Unix library on Windows. The inheritance on the underlying Win32 handles was correctly set, but the book-keeping for the CRT was leaking the value of non-inherited handles which combined with re-use of HANDLE values within processes could appear to make a CRT file descriptor "re-open". (David Allsopp, review by Nicolás Ojeda Bär)

Tools:

  • #13686: Fix Python debugger extensions (for LLDB and GDB) to restore functionality broken by #13272 in 5.3. (Nick Barnes, review by Tim McGilchrist Gabriel Scherer)

  • #12019: ocamlc: add align_double and align_int64 to ocamlc -config output. (Romain Beauxis, review by David Allsopp)

  • #12642, #13536, #14184, #14192: in the toplevel, print shorter paths for constructors and labels when only some modules along their path are open. (Gabriel Scherer, review by Florian Angeletti)

  • #13199, #13485, #13665, #13762, #13965: Support running native debuggers in ocamltest. (Tim McGilchrist, Sebastien Hinderer, David Allsopp, Antonin Décimo, review by Sebastien Hinderer, Gabriel Scherer, Antonin Décimo, and Tim McGilchrist)

  • #13764, #13779: add missing "-keywords" flag to ocamldep and ocamlprof (Florian Angeletti, report by Prashanth Mundkur, review by Gabriel Scherer)

  • #13877: ocamldoc, add a -latex-escape-underscore flag to control the escaping of _ underscore in latex references (in order to be able to match odoc behaviour). (Florian Angeletti, review by Gabriel Scherer)

  • #13906: Add support for a multicore tag in ocamltest and use it for tests that fail on mono-core systems. (Stéphane Glondu, review by Nicolás Ojeda Bär)

Manual and documentation:

  • #13751: Document support for profiling with Linux perf and frame pointers. (Tim McGilchrist, review by Gabriel Scherer and Miod Vallat)

  • #12452: Add examples to Stdlib.Fun documentation. (Hazem ElMasry, review by Florian Angeletti and Gabriel Scherer)

  • #13924: Document how to put [@deprecated] on let bindings, constructors, etc in the manual (Valentin Gatien-Baron, review by Florian Angeletti)

  • #13694: Fix name for caml_hash_variant in the C interface. (Michael Hendricks)

  • #13732: Document that custom finalizers must not access the OCaml heap, etc. (Josh Berdine, review by Stephen Dolan and Guillaume Munch-Maccagnoni)

Type system

  • (breaking change) #13830: fail rather than silently create abstract module types when avoiding (i.e. hiding) signature items, as in:
      module N = struct
        open (struct type t = A | B end)
        module type T = sig type u = t * int end
      end
    
    Before, it was succeeding with module N : sig module type T end, now it fails. Similarly for anonymous functor calls (of the form `F(struct ... end)) (Clement Blaudeau, review by Gabriel Scherer)

Compiler user-interface and warnings:

  • #13817: align spellchecking hints with the possibly misspelled identifier/ Error: Unbound type constructor "aray" Hint: Did you mean "array"? (Florian Angeletti, suggestion by Daniel Bünzli, review by Gabriel Scherer)

  • #13587: Enable native backend on x86_64 GNU/Hurd. (Samuel Thibault, review by Antonin Décimo, Sébastien Hinderer and Miod Vallat)

  • #13663: Improve the error message when GADT parameter variance cannot be checked. (Stefan Muenzel, review by Gabriel Scherer and Florian Angeletti)

  • #13646: Improve the error messages when a recursive module type references another recursive module type. (Stefan Muenzel, review by Florian Angeletti and Gabriel Scherer)

  • #13702, #13865: Specialized error messages for functors appearing in contexts where non-functors were expected module A: sig ... end = Set.Make (and the reverse) (Florian Angeletti, report by Jeremy Yallop, review by Gabriel Scherer)

  • #13788, #13813: Keep the module context in spellchecking hints. Fun.protact now prompts Did you mean "Fun.protect?" rather than Did you mean "protect?". (Florian Angeletti, suggestion by Daniel Bünzli, review by Gabriel Scherer)

  • #13428: support dump=[source | parsetree | lambda | ... | cmm | ...] in OCAMLRUNPARAM (Gabriel Scherer, review by Vincent Laviron)

  • #13493: Clearer error message in ocamlc for conflicting link options for C stubs when shared libraries are not available. (David Allsopp, review by Gabriel Scherer)

  • #13563, lighter inline code styling for output without bold support: inline code is no longer printed as "..." to avoid confusion with OCaml strings. (Florian Angeletti, review by Richard Eisenberg)

  • #13568, composable formatting for warning and alert messages (Florian Angeletti, review by Richard Eisenberg)

  • #13601: Enable natdynlink on x86_64 GNU/Hurd (Samuel Thibault, review by Sébastien Hinderer)

  • #13809: Distinguish (module M : S) and (module M) : (module S) and change locations of error messages when S is ill-typed in (module S) (Samuel Vivien, review by Florian Angeletti and Gabriel Scherer)

  • #13814, 13898: Add an unused-type-declaration warning when using a t as 'a with no other occurences of 'a (Samuel Vivien, review by Florian Angeletti, Kate Deplaix)

  • #13818: better delimited hints in error message (Florian Angeletti, review by Gabriel Scherer)

Internal/compiler-libs changes:

  • #13539, #13776: Use nanosleep instead of usleep or select, if available. (Antonin Décimo, review by Miod Vallat and Gabriel Scherer)

  • #13748: Add a .editorconfig file for basic editor auto-configuration. (Antonin Décimo, review by Gabriel Scherer and David Allsopp)

  • #13302, #14236: Store locations of longidents components (Ulysse Gérard and Jules Aguillon, review by Jules Aguillon and Florian Angeletti)

  • #13314: Comment the code of Translclass (Vincent Laviron and Nathanaëlle Courant, review by Olivier Nicole)

  • #13362: reimplement Floatarray.concat in C (caml_floatarray_concat), matching the implementation of Array.concat. (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #13624: Added location to exception definitions and type extensions (Samuel Vivien, review by Gabriel Scherer)

  • #13425: undocumented -dmatchcomp flag for the debug output of the pattern-matching compiler (Gabriel Scherer, review by Vincent Laviron and Nicolás Ojeda Bär)

  • #13460: introduce a variant of all predefined types (Gabriel Scherer, review by Ulysse Gérard and Florian Angeletti)

  • #13457, #13537: Annotate alloc/free open/close pairs of functions with compiler attributes for static analysis. (Antonin Décimo, review by Gabriel Scherer and Florian Angeletti)

  • #13464: Use generic types in call to subtype. This improves inference of type-directed disambiguation in principal mode. (Richard Eisenberg, review by Jacques Garrigue)

  • #13606: Fix Numbers.Int_base.compare (Mark Shinwell, review by Vincent Laviron)

  • #13612: Refactor type_application (Ulysse Gérard, Leo White, review by Antonin Décimo, Gabriel Scherer, Samuel Vivien, Florian Angeletti and Jacques Garrigue)

  • #13744: Refactor in collect_apply_args (Samuel Vivien, review by Florian Angeletti and Gabriel Scherer)

  • #13787: a new -dcanonical-ids option to show canonicalized identifier stamps in -d{lambda,cmm,...} outputs. (Gabriel Scherer, review by Vincent Laviron and David Allsopp, suggested by David Allsopp)

  • #13820: Add a new option -i-variance to print the variance of every type parameter; bivariance is printed as +-, and for consistency, parser is modified too to accept +- and -+ as type_variance. (Takafumi Saikawa and Jacques Garrigue, review by Florian Angeletti)

  • #13828: Apply BUILD_PATH_PREFIX_MAP to Sys.argv.(0) before storing it in .cmt and .cmti files. (David Allsopp, review by Daniel Bünzli and Gabriel Scherer)

  • #13848: Add all paths components to the cmt files indexes (Ulysse Gérard, review by Florian Angeletti)

  • #13854: Make the parser set loc_ghost more correctly, for keyword%extension syntax (Valentin Gatien-Baron, review by Florian Angeletti)

  • #13856: Add a new indirection in types AST called package that stores the content of a Tpackage node (Samuel Vivien, review by Florian Angeletti)

  • #13866: Modified occurence check that prevents recursive types for it to see the checked type as a graph rather than a tree (Samuel Vivien, report by Didier Remy, review by Florian Angeletti and Jacques Garrigue)

  • #13884 Correctly index modules in constructors and labels paths (Ulysse Gérard, review by Florian Angeletti)

  • #13946: refactor the #install_printer code in the debugger and toplevel (Pierre Boutillier, review by Gabriel Scherer and Florian Angeletti)

  • #13952: check and document the correctness of caml_domain_alone (). (Gabriel Scherer, review by KC Sivaramakrishnan, report by Olivier Nicole)

  • #13971: Keep generalized structure from patterns when typing let (Leo White, review by Samuel Vivien and Florian Angeletti)

  • (breaking change) #13972: Renamed the -no-alias-deps flag internal representation to no_alias_deps instead of transparent_modules. (Clement Blaudeau, review by Gabriel Scherer)

Build system:

  • (breaking change) #13526, #13789, #13804: Simplify the build of cross compilers This replaces the configure --with-target-bindir option by an equivalent TARGET_BINDIR variable (Samuel Hym, review by Miod Vallat, Xavier Leroy, Antonin Décimo and Sébastien Hinderer)
  • #13431: Simplify github action responsible for flagging PRs with the parsetree-changes label and extend it to mention the @ppxlib-dev team. (Nathan Rebours, review by Florian Angeletti)

  • #13494: Use native symlinks on Windows for the OCaml installation, reducing disk usage considerably. (David Allsopp, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #13789: Strictly validate the host and target triplets when building for the Windows ports to be --cygwin, -w64-mingw32 or *-pc-windows. Other Cygwin variants used to be rejected - other MSVC and mingw-w64 variants are now rejected too. (David Allsopp, review by Antonin Décimo and Gabriel Scherer)

Bug fixes:

  • #13819: Fix field initialisation bug in runtime events subsystem. (Nick Barnes, review by Gabriel Scherer).

  • #13977: Pass -fPIC when compiling C files using ocamlopt. This was a regression in OCaml 5.3. (Nicolás Ojeda Bär, review by Daniel Bünzli and Gabriel Scherer)

  • #13957: Allow 'effect' as attribute id. (Pieter Goetschalckx, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #13691 #13895: Make four globals underlying Gc.control atomic to avoid C data races against them. (Jan Midtgaard, review by Miod Vallat, Sadiq Jaffer and Antonin Décimo)

  • #13454: Output a correct trace of the C_CALLN bytecode. (Miod Vallat, review by Antonin Décimo)

  • #13595: Use x19 as Canonical Frame Address (CFA) register. This would cause backtraces to be truncated when calling no alloc C code. (Tim McGilchrist, report by Nick Barnes, review by Nick Barnes)

  • (breaking change) #13605: Fix ungenerated constraints when they where impossible due to polyvars issues (Samuel Vivien, review by Florian Angeletti, Richard Eisenberg and Jacques Garrigue)
  • #13677, #13679: domain.c: remove backup_thread_running to simplify concurrent state updates to the backup thread status. (Gabriel Scherer, review by Jan Midtgaard and Miod Vallat, report by Jan Midtgaard)

  • #13896, #14098: ocamldoc, do not wrap module description in a paragraph tag inside the table of modules (Florian Angeletti, report by John Whitington, review by Gabriel Scherer)

  • #13703: wrong explanation for some polymorphic-variant subtyping errors (Gabriel Scherer, review by Jacques Garrigue, report by Wiktor Kuchta and Richard Eisenberg)

  • #13710: Support unicode identifiers in comments. (Pieter Goetschalckx, review by Florian Angeletti and Gabriel Scherer)

  • #13763: Track type of variables bound by as-patterns (Leo White, review by Gabriel Scherer, port by Vincent Laviron)

  • #13778, #13811: do not warn for unused type declarations when the type is used in a first-class module type (module S with type t = int). (Florian Angeletti, report by Nicolás Ojeda Bär, review by Gabriel Scherer)

  • #13790: Fix bytecode-only build of Cygwin when flexlink is being bootstrapped with the compiler. (David Allsopp, review by Antonin Décimo and Miod Vallat)

  • #13812: Add forgotten check about the validity of the type variable name on the right-hand side of _ as _. (Samuel Vivien, review by Gabriel Scherer)

  • #13845: Fix bug in untypeast/pprintast for value bindings with polymorphic type annotations. (Chris Casinghino, review by Florian Angeletti and Gabriel Scherer)

  • #13930, #13933: Fix bugs in recursive values definitions involving lazy values that have already been evaluated. (Gabriel Scherer, review by Vincent Laviron, report by Vincent Laviron)

  • #13867: Fix bug with some recursive bindings of lazy values. (Guillaume Bury and Vincent Laviron, review by Stefan Muenzel and Gabriel Scherer)

  • #13931: fix bugs in nested recursive value definitions. (Gabriel Scherer, review by Vincent Laviron, report by Vincent Laviron)

  • #13875, #13878: Add dedicated constructor for mutable variable access in Cmm to prevent bugs linked to incorrect handling of coeffects. (Vincent Laviron, review by Gabriel Scherer)

  • #13880: Make object stat counters atomic (Dimitris Mostrous, review by Gabriel Scherer and Nicolás Ojeda Bär)

  • #13172, #13829: Fix a missing check of illegal recursive module-type definitions (Clement Blaudeau, review by Florian Angeletti)

  • #13541, #13777: Using C++11 thread_local causes name-mangling issues when linking with flexlink on Cygwin. (Antonin Décimo and David Allsopp, report by Kate Deplaix)

  • (breaking change) #13874, #13882: Make evaluation order consistent for applications when using the non-flambda native compiler (Vincent Laviron, report by Jean-Marie Madiot, review by Gabriel Scherer)
  • #13942: Fix assertion on empty array case (Olivier Nicole, review by Gabriel Scherer)

  • #13950: Avoid tearing in Array.sub (Gabriel Scherer and Olivier Nicole, report by Jan Midtgaard, review by Gabriel Scherer)

  • #13928, #13944: Fix handling of excessively nested unboxed types (Vincent Laviron, review by Gabriel Scherer)

  • #13987: Remove a spurious TSan report in case of benign data race between major GC read and write from the mutator (fixes #13427) (Olivier Nicole, report by Thomas Leonard, review by Gabriel Scherer)

  • #14007, #14015: Fix memory corruption when an exception is raised during demarshaling. (Benoît Vaugon, review by David Allsopp and Gabriel Scherer)

  • #14025: fix data race between compaction and domain termination (Gabriel Scherer, review by Jan Midtgaard, report by Jan Midtgaard)

  • #13956 Fix a regression introduced in #13308 triggering wrong unused warnings. (Ulysse Gérard, review by Florian Angeletti)

  • #14070: also point to label mismatches in error messages for labelled tuples (Florian Angeletti, review by Gabriel Scherer)

  • #14088, #14091: fix non-deterministic code generation in matching.ml (backport of rescript-lang/rescript#7557) (Christiano Calgano, review by Gabriel Scherer and Vincent Laviron)

  • #14105: Fix a loop in Pprintast that could result in a hang when printing constructor (::) in isolation. (Ulysse Gérard, review by Nicolás Ojeda Bär and Florian Angeletti)

  • #14108: toplevel, fix a typo in directive type mismatch (Florian Angeletti, review by Gabriel Scherer)

  • #13586, #14093: Fix closing an out_channel during flush (Stephen Dolan, report by Jan Midtgaard, investigation by Nick Roberts, review by Antonin Décimo and Miod Vallat)

  • #14101, #14139: define atomic helper types inside caml/misc.h to improve header compatibility with C++ (Florian Angeletti, report by Kate Deplaix, review by Gabriel Scherer)

  • #14135: Fix a rare internal typechecker error when combining recursive modules, polymorphic fields or methods, and constrained type parameters. (Florian Angeletti, review by Gabriel Scherer)

  • #14169: runtime, fix cache miss within the stack fragments cache (Florian Angeletti, review by Gabriel Scherer)

  • #14196, #14197: ocamlprof: do not instrument unreachable clauses (Gabriel Scherer, review by Nicolás Ojeda Bär, report by Ali Caglayan)

  • #14200, #14202 : bad variance check with private aliases (Jacques Garrigue, report and review by Stephen Dolan)

  • #14061, #14209: fix a memory-ordering bug in Weak.set that could result in uninitialized memory seen by Weak.get on another domain. (Damien Doligez, review by Gabriel Scherer)

  • #14214, #14221: fix a confused error message for module inclusions, functor error messages were missing some type equalities potentially leading to nonsensical "type t is not compatible with type t" submessage (Florian Angeletti, report by Basile Clément, review by Gabriel Scherer)

  • #14238: Fix certain variadic macros in misc.h which could trigger C warnings under certain conditions in prerelease versions of OCaml 5.4. (Antonin Décimo, review by Nicolás Ojeda Bär)

You can comment on this announcement on the OCaml Discuss forums!

We're pleased to announce that OCaml.org now has dedicated RSS feeds and pages for stable and experimental announcements, introduced in PR #3278!

What's new:

  • OCaml Changelog at ocaml.org/changelog — Official stable release announcements and updates from the OCaml compiler, OCaml infrastructure, and the OCaml Platform Tools
  • Backstage OCaml at ocaml.org/backstage — Updates on experimental releases, work-in-progress, and opportunities to contribute to the development of the OCaml Platform and its infrastructure

This separation helps keep the main changelog focused on production-ready releases while providing a dedicated space for those interested in experimental work, early testing, and contributing to OCaml's development.

Both pages have their own RSS feeds, so you can subscribe to whichever matches your needs—or both!

We welcome your feedback as we continue improving OCaml.org.

Feedback on this post is welcomed on Discuss!

We are happy to announce the release of opam-publish 2.7.0 which brings the ability to more easily publish your releases automatically, thanks to @filipeom:

  • SSH keys aren't used to push the branch to the user's fork anymore. Instead the token we already require is used.
  • If undefined, the git config variables user.name and user.email are automatically filled with the github username and username@opam-publish as a backup

An example of the new automated setup can be found in this CI job.

Other minor changes include:

  • The switch from lwt_ssl to tls-lwt which avoid one dependency and avoid depending on the system libssl

Happy publishing! <> <> The opam team <> <> :camel:

Merlin 5.6 is now available with support for OCaml 5.4, a new type navigation command, and several bug fixes!

Key Changes

New locate-types command

The new locate-types command returns all locatable type identifiers in an expression as a tree structure. Unlike locate-type, which only handles simple type constructors and ignores type arguments, locate-types works on complex types like (int, Foo.t) result. You can now navigate to int, Foo.t, or result individually. This enables better "Go to Type Definition" functionality in editors that support it.

OCaml 5.4 support

This release supports OCaml 5.4.

Improved error recovery

Type checking now handles mutually recursive definitions better when they contain errors, providing more useful feedback during development.

OpenBSD support

Fixed merlin_reader to work correctly on OpenBSD.

Vim plugin fix

:MerlinOccurrencesProjectWide no longer errors when it can't gather code previews.

See the GitHub repository and the related announcement on the Discuss forums for more details.

See full changelog

CHANGES:

  • merlin binary
    • Add locate-types command (#1951)
  • merlin library
    • Fix merlin_reader for OpenBSD (#1956)
    • Improve recovery of mutually recursive definitions (#1962, #1963, fixes #1953)
    • Support for OCaml 5.4 (#1974)
  • vim plugin
    • Fix error when :MerlinOccurrencesProjectWide fails to gather code previews (#1970)
    • Add more short-paths tests cases (#1904)

There is now a dedicated Security Response Team (SRT) to handle vulnerability reports and coordinate security responses. If you discover a security issue in the OCaml compiler, runtime, standard library, or ecosystem tools, you can report it confidentially to the team.

The SRT follows responsible disclosure practices, working with reporters to validate issues, develop fixes, and coordinate public disclosure timelines. This effort also helps OCaml developers and companies comply with emerging security regulations like the EU Cyber Resilience Act.

For more information, see the announcement on Discuss.

We're happy to announce the release of ocaml-lsp-server 1.23.1!

This maintenance release fixes three key issues:

  • Method hover now works: Hovering over object method calls now correctly displays type information instead of showing "No information available"
  • OCamllex files open without errors: Fixed an error that occurred when opening .mll (OCamllex lexer) files in editors like NeoVim
  • Yojson compatibility: Ensures the language server works with both yojson 2.0 and 3.0

Update via opam: opam update && opam upgrade ocaml-lsp-server

For more details, see the related announcement on the Discuss forums!

See full changelog

Fixes

  • Fix hover on method calls not showing the type. (#1553, fixes #1552)
  • Fix error on opening .mll files (#1557)
  • Ensure compatibility with both yojson 2.0 and 3.0. (#1534)

We're pleased to announce ppxlib 0.36.2, a maintenance release with two bug fixes related to OCaml 5.2 AST changes for type constraints in let bindings.

What's Fixed

Ast_builder compatibility: The value_binding constructor now automatically handles the AST migration from OCaml 4.14 to 5.2, correctly generating pvb_constraint fields when type constraints are present. This means PPX authors don't need to manually update their code for the new AST representation.

PPrintast output: Fixed pretty-printing of legacy Ppat_constraint nodes with Ptyp_poly to produce valid OCaml syntax, ensuring generated code remains compilable during the transition period.

Both fixes improve compatibility across OCaml compiler versions.

See full changelog

CHANGES:

  • Make Ast_builder's default value_binding constructor generate the proper
    pvb_constraint from the pattern and expression arguments.
    (#589, @NathanReb)
  • Fix pprintast to output correct syntax from Ppat_constraint (pat, Ptyp_poly ...)
    nodes until they are completely dropped. (#588, @NathanReb)

You can comment on this announcement on the OCaml discuss forums.

Here at OCamlPro we’re happy to announce the (long awaited) release of ocp-indent.1.9.0.

The full release notes are available here if you want the detailed version.

1.9.0 contains mostly bug fixes, better and more consistent indentation of fun _ -> and |>, compatibility with cmdliner.1.3.0 and above (it works with 2.0.0) and a new utility tool: ocp-indent-gen-rules for those of you who would like to try ocp-indent in a dune fmt like workflow.

This last bit is documented here. This is a feature that some of us wanted internally at OCamlPro so we decided to ship it with the tool as an experiment. We’d really like to hear if this fits your ocp-indent usage so please don’t hesitate to try it out and give us some feedback.

We’re also interested in hearing how you use ocp-indent in general and what you expect from it. Reach out if you have any request!

We’ve also updated the repo to fit the more recent development standards. We migrated the test suite to dune cram tests and re-enabled them in opam. Hopefully this should make contributing to ocp-indent a smoother experience!

Also be aware that we’ll do our best to maintain ocp-indent more actively from now on.

We’d like to thank our external contributors for this release: @dbuenzli, @nojb, @bcc32 and @Julow.

Happy indenting!

See full changelog

CHANGES:

  • Fix detection of let vs letin after a struct (#324, @Julow)
  • Treat |> as a monadic operator (#322, @nberth)
  • Prevent Args out of range error in ocp-indent-buffer (#327, @bcc32)
  • Fix "Missing ‘lexical-binding’ cookie" warning in Emacs (#329, @nojb)
  • Fix a bug where ocp-indent translate LF to CRLF when run on Windows instead
    of preserving the input's newlines. (#334, @nojb)
  • Add ocp-indent-gen-rules to support dune fmt like workflow with ocp-indent
    (#333, @NathanReb)

We are happy to announce the release of opam-publish 2.6.0, which brings opam-publish closer to the ability to more easily publish your releases automatically. This release brings:

  • A new OPAM_PUBLISH_GH_TOKEN environment variable and --token argument are now available to pass the GitHub token, thanks to @filipeom
  • The addition of a message after the PR is open, to notify users that they can re-run opam-publish to update the PR, thanks to @punchagan

Happy publishing! <> <> The opam team <> <> :camel:

Dune 3.20.2

The Dune Team is happy to announce the release of Dune 3.20.2.

This release introduces some minor fixes and restores the build on Cygwin.

See full changelog

Fixed

  • Fix jsoo separate compilation with modules_without_implementation. Regression introduced in #10767. (#12320, fixes #12306 @hhugo)

  • Fix runtest-js mistakenly using wrong dependencies (#12324, @vouillon)

  • Remove empty .cram.test.t directory during the running of a cram test. (#12329, fixes #12321, @Alizter)

  • Fix Cygwin bootstrap (#12325, fixes #12316, @Alizter)

TL;DR

ocaml-eglot provides full OCaml language support in Emacs through the Language Server Protocol (LSP) instead of direct Merlin integration. It offers the same features as merlin.el with simplified setup and enhanced capabilities like project-wide search. If you're starting fresh or want a more standardized approach, try ocaml-eglot, which is actively maintained. If your current merlin.el setup works well, you can continue using it.

Quick start: Install ocaml-lsp-server, add ocaml-eglot to your Emacs config, and get the same OCaml development experience with less configuration.

What is ocaml-eglot?

ocaml-eglot connects Emacs to ocaml-lsp-server using the Language Server Protocol, providing a standardized way to get OCaml language support.

Since the recent versions of Emacs (29), eglot, an LSP client, has been shipped with Emacs. However, merlin.el provides more features than LSP (which is designed to be generic), so relying solely on the features of LSP and eglot would limit functionality. Thus, we extended the LSP server to support more features, and ocaml-eglot allows you to benefit from these features in Emacs.

ocaml-eglot is a minor mode. It therefore works in conjunction with a major mode to edit Caml code. Examples of major modes include tuareg, caml-mode and the recent neocaml.

Who Should Use ocaml-eglot?

Use ocaml-eglot if you:

  • Are starting fresh with OCaml
  • If you use or want to use Emacs
  • Want simplified configuration with automatic setup
  • Use multiple editors and want consistent OCaml support
  • Want access to project-wide search and rename features
  • Want to rely on an actively maintained project that evolves over time

If your current setup is working perfectly and is heavily customised, merlin.el will still keep working, so there's no immediate need to migrate. However, for the moment, we don't plan to actively maintain merlin.el -- unless we receive a lot of requests.

Getting Started

Follow the installation instructions in the ocaml-eglot README.

When migrating from merlin.el to ocaml-eglot, your existing keybindings should work immediately!

Features

Error Navigation: Quick jump to next/previous errors

Type Information: Display types under cursor with adjustable verbosity, navigate enclosing expressions

Code Generation: Pattern matching construction, case completion, wildcard refinement via "destruct" feature

Navigation: Jump between language constructs (let, module, function, match), navigate phrases and pattern cases

Search: Find definitions, declarations, and references

For a detailed list of features, see the ocaml-eglot README.

Next Steps

  1. Try the basic setup with an existing OCaml project
  2. Explore all the features of ocaml-eglot
  3. Provide feedback at ocaml-eglot's GitHub Issues

Documentation

Related Releases

On January 17, 2025, ocaml-eglot version 1.0.0 was released, providing a new minor emacs mode to enable the editor features provided by ocaml-lsp-server. Subsequent releases 1.1.0 and 1.2.0 enable support for flycheck as a configurable alternative to flymake (1.0.0 release), Emacs 30.1 support, better user experience and error handling, as well as support for new features.

Dune 3.20.1

The Dune Team is happy to announce the release of Dune 3.20.1.

This release introduces some minor fixes and reverts the dune file formatter change.

See full changelog

Fixed

  • Fix runtest-js mistakenly depending on byte (fixes #12243, #12242, @vouillon and @Alizter)

  • Fix the interpretation of paths in dune runtest when running from within a subdirectory. (#12251, fixes #12250, @Alizter)

Changed

  • Revert formatting change introduced in 3.20.0 making long lists in s-expressions fill the line instead of formatting them in a vertical way (#12245, reverts #10892, @nojb)

Dune 3.20.0

The Dune Team is happy to announce the release of Dune 3.20.0.

This release contains some important bug fixes. It contains new features for tests, such as the possibility to use an alias and the possibility to declare a timeout for cram tests. This release also provides new possibilities for the watch mode, like the ability to run an executable or promote files while the watch mode is running.

A significant change in this release is how the dune file formatter acts. It will now try to fill the line instead of using the vertical format.

See full changelog

Fixed

  • Stop re-running cram tests after promotion when it's not necessary (#11994, @rgrinberg)

  • fix: $ dune subst should not fail when adding the version field in opam files (#11801, fixes #11045, @btjorge)

  • Kill all processes in the process group after the main process has terminated; in particular this avoids background processes in cram tests to stick around after the test finished (#11841, fixes #11820, @Alizter, @Leonidas-from-XIV)

Added

  • (tests) stanzas now generate aliases with the test name. To run (test (name a)) you can do dune build @runtest-a. (#11558, grants part of #10239, @Alizter)

  • Inline test libraries now produce aliases runtest-name_of_lib allowing users to run specific inline tests as dune build @runtest-name_of_lib. (#11109, partially fixes #10239, @Alizter)

  • feature: $ dune subst use version from dune-project when no version control repository has been detected (#11801, @btjorge)

  • Allow dune exec to run concurrently with another instance of dune in watch mode (#11840, @gridbugs)

  • Introduce %{os}, %{os_version}, %{os_distribution}, and %{os_family} percent forms. These have the same values as their opam counterparts. (#11863, @rgrinberg)

  • Introduce option (implicit_transitive_deps false-if-hidden-includes-supported) that is equivalent to (implicit_transitive_deps false) when -H is supported by the compiler (OCaml >= 5.2) and equivalent to (implicit_transitive_deps true) otherwise. (#11866, fixes #11212, @nojb)

  • Add dune describe location for printing the path to the executable that would be run (#11905, @gridbugs)

  • dune runtest can now understand absolute paths as well as run tests in specific build contexts (#11936, @Alizter).

  • Added 'empty' alias which contains no targets. (#11556 #11952 #11955 #11956, grants #4161, @Alizter and @rgrinberg)

  • Allow dune promote to properly run while a watch mode server is running (#12010, @ElectreAAS)

  • Add --alias and --alias-rec flags as an alternative to the @@ and @ syntax in the command line (#12043, fixes #5775, @rgrinberg)

  • Added a (timeout <float>) field to the (cram) stanza to specify per-test time limits. Tests exceeding the timeout are terminated with an error. (#12041, @Alizter)

Changed

  • Format long lists in s-expressions to fill the line instead of formatting them in a vertical way (#10892, fixes #10860, @nojb)

  • Switch from MD5 to BLAKE3 for digesting targets and rules. BLAKE3 is both more performant and difficult to break than MD5 (#11735, @rgrinberg, @Alizter)

  • Print a warning when dune build runs over RPC (#11833, @gridbugs)

  • Stop emitting empty module group wrapper .js file in melange.emit (#11987, fixes #11986, @anmonteiro)

Utop 2.16.0

We're happy to announce the release of Utop 2.16.0!

This utop release adds OCaml 5.4 support, restores backtrace functionality, improves preprocessor and Emacs integration, and relocates configuration files to a dedicated utop subdirectory.

See full changelog

opam 2.4.1

Feedback on this post is welcomed on Discuss!

We are pleased to announce the release of opam 2.4.1 fixing a regression affecting some uses of pin-depends, and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Changes

  • Fix pin-depends being ignored with opam install --deps-only (#6610)

This release also extends the tests.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.4.1"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.4.1"

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

  1. 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.

Happy hacking!

opam 2.4.0

Feedback on this post is welcomed on Discuss!

We are extremely happy to announce the release of opam 2.4.0 and encourage all users to upgrade. Please read on for installation and upgrade instructions.

Try it!

The upgrade instructions are unchanged:

  1. Either from binaries: run

For Unix systems

bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh) --version 2.4.0"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) } -Version 2.4.0"

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

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

You should then run:

opam init --reinit -ni

Major changes

  • On opam init the compiler chosen for the default switch will no longer be ocaml-system (#3509) This was done because the system compiler (as-is your ocaml installed system wide, e.g. /usr/bin/ocaml) is known to be under-tested and prone to a variety of bugs and configuration issues. Removing it from the default compiler allows new-comers a more smooth experience. Note: if you wish to use it anyway, you are always able to do it explicitly using opam init --compiler=ocaml-system

  • GNU patch and the diff command are no longer runtime dependencies. Instead the OCaml patch library is used (#6019, #6052, #3782, ocaml/setup-ocaml#933) Doing this we've removed some rarely used features of GNU Patch such as the support of Context diffs. The new implementation only supports Unified diffs including the git extended headers, however file permission changes via said extended headers have no effect.

  • Add Nix support for external dependencies (depexts) by adding support for stateless package managers (#5982). Thanks to @RyanGibb for this contribution

  • Fix opam install <local_dir> with and without options like --deps-only or --show-action having unexpected behaviours (#6248, #5567) such as:

    • reporting Nothing to do despite dependencies or package not being up-to-date
    • asking to install the wrong dependencies
  • opam switch create [name] <version> will not include compiler packages flagged with avoid-version/deprecated in the generated invariant anymore, unless compiler flagged avoid-version/deprecated are the only ones available (#6494). This will allow opam to avoid the use of the ocaml-system package unless actually explicitly requested by the user. The opam experience when the ocaml-system compiler is used is known to be prone to a variety of bugs and configuration issues.

  • opam install --deps-only no longer requires unicity of package version between the request and the installed packages. In other words, if you have pkg.1 installed, installing the dependencies of pkg.2 no longer removes pkg.1 if the installed packages are compatible. This also allows to install dependencies of conflicting packages when their dependencies are compliant. (#6520)

UI changes

  • opam show now displays the version number of packages flagged with avoid-version/deprecated gray (#6354)

  • opam upgrade: Do not show the message about packages "not up-to-date" when the package is tagged with avoid-version/deprecated (#6271)

  • Fail when trying to pin a package whose definition could not be found instead of forcing interactive edition (e.g. this could happen when making a typo in the package name of a pin-depends) (#6322)

New commands / options

  • Add opam admin compare-versions to compare package versions for sanity checks. Thanks to @mbarbin for this contribution

  • Add opam lock --keep-local to keep local pins url in pin-depends field (#4897)

  • Add opam admin migrate-extrafiles which moves all extra-files of an existing opam repository into extra-sources. Thanks to @hannesm for this contribution

  • The -i/--ignore-test-doc argument has been removed from opam admin check (#6335)

Other noteworthy changes

  • opam pin/opam pin list now displays the current revision of a pinned repository in a new column. Thanks to @desumn for this contribution

  • The prebuilt Windows binary now includes Cygwin's setup-x86_64.exe in the binary itself as fallback in case cygwin.com is inaccessible (#6538). Opam will also no longer fail if cygwin.com is inaccessible when checking for upgrades of setup-x86_64.exe (#6495, partial fix for #6474)

  • Symlinks in repositories are no longer supported (#5892)

  • Fix sandboxing support in NixOS (#6333)

  • Add the OPAMSOLVERTOLERANCE environment variable to allow users to fix solver timeouts for good (#3230)

  • Fix a regression on opam upgrade <package> upgrading unrelated packages (#6373). Thanks to @AltGr for this contribution

  • Fix pin-depends for with-* dependencies when creating a lock file (#5428)

  • opam admin check now sets with-test and with-doc to false instead of true

  • Add apt-rpm/ALTLinux family support for depexts. Thanks to @RiderALT for this contribution

  • Remove handling of the OPAMSTATS environment variable (#6485). Thanks to @hannesm for this contribution

  • Fix the detection of installed external packages on OpenBSD to not just consider manually installed packages (#6362). Thanks to @semarie for this contribution

  • Disable the detection of available system packages on SUSE-based distributions (#6426)

And many other general, performance and UI improvements were made and bugs were fixed. You can take a look to previous blog posts. API changes and a more detailed description of the changes are listed in:

This release also includes PRs improving the documentation and improving and extending the tests.

Please report any issues to the bug-tracker.

We hope you will enjoy the new features of opam 2.4!


Special thanks to the whole haematology department of the NHS Greater Glasgow for making this release – in the state that it is – possible. Fighting cancer is not easy but it is much more bearable with great people <3

Odoc 3.1.0

We're excited to announce the release of odoc 3.1.0! This release brings several new features, important improvements, and bug fixes to OCaml's documentation generator.

What's New

OCaml 5.4.0 Compatibility

Full support for OCaml 5.4.0 has been added, ensuring odoc stays current with the latest OCaml releases.

New Output Formats and Options

  • Enhanced LaTeX Generator: New command-line arguments --shorten-beyond-depth and --remove-functor-arg-link provide more control over LaTeX output formatting

Key Improvements

Modernized Dependencies

The cmdliner compatibility layer has been removed as it's no longer needed, simplifying the codebase and reducing maintenance overhead.

Updated System Requirements

Support for OCaml versions prior to 4.08 has been dropped, allowing the project to leverage more modern language features and reduce compatibility complexity.

Better Configuration Management

Libraries from packages can now be referenced when added in odoc-config.sexp, improving flexibility in documentation project setup.

Improved LaTeX Output

  • Heading labels now use full paths to improve navigation and reference accuracy
  • Page and anchor separation in LaTeX labels prevents naming collisions

Bug Fixes

This release addresses several important issues:

  • Fixed META file parsing when dependencies are absent
  • Resolved rendering problems on medium screen sizes without global sidebar
  • Corrected occurrence generation for documentation CI systems
  • Ensured hidden pages never receive links, preventing broken references

Getting Started

To install odoc 3.1.0:

opam install odoc

For existing users, upgrade with:

opam upgrade odoc

Contributors

Special thanks to all contributors who made this release possible: @jonludlam, @Octachron, @davesnx, @dbuenzli, @panglesd, and @lukemaurer.

What's Next

We continue to work on expanding odoc's capabilities and improving documentation generation. The development team remains committed to making OCaml documentation more accessible and comprehensive.

Happy documenting!

See full changelog

### Added

Changed

Fixed

We're happy to announce the release of Ppxlib 0.36.1!

See full changelog
  • Fix ppxlib driver's AST to source printer. Our copy of pprintast was not properly updated which resulted in incorrect printing of value bindings' constraints (#585, @NathanReb)

We're pleased to announce the release of OCaml LSP Server 1.23.0!

See full changelog

Features

  • Make inlay-hint for function parameters configurable (#1515)
  • Add custom ocamllsp/jumpToTypedHole to navigate through typed holes (#1516)
  • Add a code-action for combining pattern cases (just relaying on regex) (#1514)
  • Allow (by configuration) shortening of diagnostics (just highlighting the first line) (#1513)
  • Fix yojson_of_t for Nullable_option: serialize None as Null instead of asserting false (#1525 fixes #1524)

Fixes

  • Support for class, class type, method and property for DocumentSymbol query (#1487 fixes #1449)
  • Fix inlay-hint for function parameters (#1515)
  • More precise diagnostics in the event of a failed identifier search (Definition_query) (#1518)
  • Remove ocamlformat application after destruct (that remove some useful parenthesis) (#1519)

Merlin 5.5-503 is now available! This release addresses several long-standing issues with jump-to-definition, occurrences reporting, and inlay hints while adding new utilities for working with typed holes.

Key changes include enhanced locate functionality that can now disambiguate between files with identical names and contents, fixes to occurrences that properly report stale files, and corrected inlay hints on function parameters. The outline feature has been expanded to handle class types and locally defined values, with a new selection field that provides the exact location of symbols. Several jump-to-definition issues have been resolved, and the destruct feature no longer hangs when processing patterns with the cons operator (::).

The merlin library now exposes utilities for manipulating typed holes through Merlin_analysis.Typed_hole, and ocaml-index has improved performance through better granularity in index reading via segmented marshalization. This release also includes fixes for typer assertion failures and cache backtracking issues that were causing crashes in certain scenarios.

See full changelog
  • merlin library
    • Expose utilities to manipulate typed-holes in Merlin_analysis.Typed_hole
      (#1888)
    • locate can now disambiguate between files with identical names and contents
      (#1882)
    • occurrences now reports stale files (#1885)
    • inlay-hints fix inlay hints on function parameters (#1923)
    • Fix issues with ident validation and Lid comparison for occurrences (#1924)
    • Handle class type in outline (#1932)
    • Handle locally defined value in outline (#1936)
    • Fix a typer issue triggering assertions in the short-paths graph (#1935,
      fixes #1913)
    • Downstreamed a typer fix from 5.3.X that would trigger assertions linked
      to scopes bit masks when backtracking the typer cache (#1935)
    • Add a new selection field to outline results that contains the location of
      the symbol itself. (#1942)
    • Fix destruct hanging when printing patterns with (::). (#1944, fixes
      ocaml/ocaml-lsp#1489)
    • Reproduce and fix a handful of jump-to-definition (locate) issues (#1930,
      fixes #1580 and #1588, workaround for #1934)
  • ocaml-index
    • Improve the granularity of index reading by segmenting the marshalization
      of the involved data-structures. (#1889)
  • test suite
    • Add a test case illustrating wrong open order proposed in issue #1900. (#1901)

We're pleased to announce the release of OCaml LSP Server 1.21.0-4.14!

See full changelog

Features

  • Make inlay-hint for function parameters configurable (#1515)

  • Add custom ocamllsp/jumpToTypedHole to navigate through typed holes (#1516)

  • Add a code-action for combining pattern cases (just relaying on regex) (#1514)

  • Allow (by configuration) shortening of diagnostics (just highlighting the first line) (#1513)

  • Fix yojson_of_t for Nullable_option: serialize None as Null instead of asserting false (#1525 fixes #1524)

Fixes

  • Support for class, class type, method and property for DocumentSymbol query (#1487 fixes #1449)

  • Fix inlay-hint for function parameters (#1515)

  • More precise diagnostics in the event of a failed identifier search (Definition_query) (#1518)

  • Remove ocamlformat application after destruct (that remove some useful parenthesis) (#1519)

  • Add a new server option standardHover, that can be used by clients to
    disable the default hover provider. When standardHover = false
    textDocument/hover requests always returns with empty result. (#1416)

We are pleased to announce the release of Merlin 4.19-414!

See full changelog
  • merlin library
    • Expose utilities to manipulate typed-holes in Merlin_analysis.Typed_hole
      (#1888)
    • inlay-hints fix inlay hints on function parameters (#1923)
    • Handle class type in outline (#1932)
    • Handle locally defined value in outline (#1936)
  • vim plugin
    • Added support for search-by-type (#1846)
      This is exposed through the existing :MerlinSearch command, that
      switches between search-by-type and polarity search depending on the
      first character of the query.

Dune 3.19.1

The Dune Team is happy to announce the release of Dune 3.19.1.

This patch release contains a fix reverting some regressions on how dune exec handles processes. It restores the previous behaviour.

See full changelog

Fixed

  • Revert changes in dune exec behaviour introduced in 3.19.0. (#11879, fixes #11870, #11867 and #11881, @Alizter)

Dune 3.19.0

The Dune Team is happy to announce the release of Dune 3.19.0.

This release contains some important fixes along with some improvements for the foreign_library stanza. It introduces support for concurrent builds through the RPC server.

See full changelog

Fixed

  • Fixed a bug that was causing cram tests attached to multiple aliases to be run multiple times. (#11547, @Alizter)

  • Fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

  • Fix: Evaluate enabled_if when computing the stubs for stanzas such as foreign_library (#11707, @Alizter, @rgrinberg)

  • Fix $ dune describe pp for libraries in the presence of (include_subdirs unqualified) (#11729, fixes #10999, @rgrinberg)

  • Fix $ dune subst in sub directories of a git repository (#11760, fixes #11045, @Richard-Degenne)

  • Fix a crash involving Path.drop_prefix when using Melange on Windows (#11767, @nojb)

Added

  • Added detection and warning for common typos in package dependency constraints (#11600, fixes #11575, @kemsguy7)

  • Added (extra_objects) field to (foreign_library) stanza with (:include) support. (#11683, @Alizter)

Changed

  • Allow build RPC messages to be handled by dune's RPC server in eager watch mode (#11622, @gridbugs)

  • Allow concurrent build with RPC server (#11712, @gridbugs)

Dune 3.18.2

The Dune Team is happy to announce the release of Dune 3.18.2.

This release contains a bug fix to fix a compatibility issue with ocaml.5.4.0.

See full changelog

Fixed

  • fix compatibility with ocaml.5.4.0 by avoiding shadowing sigwinch (@nojb, #11639)

Dune 3.18.1

The Dune Team is happy to announce the release of Dune 3.18.1!

This release contains a bug fix for pkg-config that prevents it from finding some libraries in specific contexts.

See full changelog

Fixed

  • fix: pass pkg-config (extra) args in all pkgconfig invocations. A missing --personality flag would result in pkgconf not finding libraries in some contexts. (#11619, @MisterDA)

Dune 3.18.0

The Dune Team is happy to announce the release of Dune 3.18.0!

This release contains changes to support the new x-maintenance-intent field by default. It also contains some changes regarding the cache about how it handles file permissions. It introduces a new (format-dune-file ...) stanza with the intention to formalize the dune format-dune-file command as an inside rule. Finally, it includes various bug fixes for Dune.

See full changelog

Fixed

  • Support HaikuOS: don't call execve since it's not allowed if other pthreads have been created. The fact that Haiku can't call execve from other threads than the principal thread of a process (a team in haiku jargon), is a discrepancy to POSIX and hence there is a bug about it. (@Sylvain78, #10953)

  • Fix flag ordering in generated Merlin configurations (#11503, @voodoos, fixes ocaml/merlin#1900, reported by @vouillon)

Added

  • Add (format-dune-file <src> <dst>) action. It provides a replacement to dune format-dune-file command. (#11166, @nojb)

  • Allow the --prefix flag when configuring dune with ocaml configure.ml. This allows to set the prefix just like $ dune install --prefix. (#11172, @rgrinberg)

  • Allow arguments starting with + in preprocessing definitions (starting with (lang dune 3.18)). (@amonteiro, #11234)

  • Support for opam (maintenance_intent ...) in dune-project (#11274, @art-w)

  • Validate opam maintenance_intent (#11308, @art-w)

  • Support not in package dependencies constraints (#11404, @art-w, reported by @hannesm)

Changed

  • Warn when failing to discover root due to reads failing. The previous behavior was to abort. (@KoviRobi, #11173)

  • Use shorter path for inline-tests artifacts. (@hhugo, #11307)

  • Allow dash in dune init project name (#11402, @art-w, reported by @saroupille)

  • On Windows, under heavy load, file delete operations can sometimes fail due to AV programs, etc. Guard against it by retrying the operation up to 30x with a 1s waiting gap (#11437, fixes #11425, @MSoegtropIMC)

  • Cache: we now only store the executable permission bit for files (#11541, fixes #11533, @ElectreAAS)

  • Display negative error codes on Windows in hex which is the more customary way to display NTSTATUS codes (#11504, @MisterDA)

Odoc 3.0.0

We are delighted to announce the release of Odoc 3! This is a big release with loads of new features and bug fixes, and we encourage everyone to install it and try the new features!

This release has been cooking for a long time - it’s been more than a year since odoc 2.4 landed, and a huge amount of work has gone into this. Thanks to the many others who contributed, either by code or by comments: @juloo, @panglesd, @EmileTrotignon, @gpetiot, @trefis, @sabine, @dbuenzli, @yawaramin, and more.

Here is an overview of some major new features:

  • Search by type! Our detective sherlodoc will find your lost value given its type.
  • Odoc 3 features a global sidebar, allowing you to discover all documentation pages
  • The generated documentation include the source code. You can jump from any item in the documentation straight to its rendered source; no matter how much of OCaml’s complex module system you are using.
  • You can now add images to your documentation, as well as video and audio files Hierarchical documentation pages allow you to structure your documentation better
  • Reference items from other packages! With the ability to use cross-package links in your documentation, the generated documentation is now truly connected.
  • The build dependencies are friendlier with incremental build systems, allowing better shared build caches

With this release we’re including a driver that makes use of all the exciting new features of odoc. This driver has been used to create the docs site for the various odoc tools. However, Dune does not yet support odoc 3 since the Dune rules for running odoc via Dune need to be rewritten to reflect the odoc's new CLI and the new incremental build related capabilities odoc 3 brings.

Until Dune supports odoc 3, here is how to get started:

$ opam install odoc-driver # will install odoc 3
$ odoc_driver odoc odoc-parser odoc-driver odoc-md sherlodoc --remap

and point your browser at _html/index.html. This example shows odoc_driver creating the docs for exactly the 5 packages specified. While doing so, it will remap links to other packages to instead link to their documentation page hosted on ocaml.org (see "Remapping dependencies" in the odoc documentation).

If you try the above command, you'll note something interesting, and hopefully this will encourage you to run odoc_driver on your own packages before you release them, as then you'll be able to avoid slightly embarrassing post-release fixes like this one 😬

See full changelog

Added

  • Add png, pdf and jpeg image support to the latex backend by Octachron · Pull Request #1297 · ocaml/odoc · GitHub
  • Add header field to the json output by panglesd · Pull Request #1314 · ocaml/odoc · GitHub
  • Extract code blocks by name by panglesd · Pull Request #1326 · ocaml/odoc · GitHub

Changed

  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Disable warnings coming from linking implementations by jonludlam · Pull Request #1319 · ocaml/odoc · GitHub
  • Driver compile warnings by jonludlam · Pull Request #1323 · ocaml/odoc · GitHub
  • Fix "box model" for code blocks by panglesd · Pull Request #1317 · ocaml/odoc · GitHub
  • Store raw content of code blocks in parser's AST by panglesd · Pull Request #1325 · ocaml/odoc · GitHub

Fixed

  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Don't backtrace on invalid input in compile-deps by jonludlam · Pull Request #1313 · ocaml/odoc · GitHub
  • Fix indentation bug with verbatim in tags by jonludlam · Pull Request #1312 · ocaml/odoc · GitHub
  • Driver: Check for missing/unknown opam packages by jonludlam · Pull Request #1311 · ocaml/odoc · GitHub
  • Fix suppress_warnings parameter by jonludlam · Pull Request #1304 · ocaml/odoc · GitHub
  • Further fixes for virtual libraries by jonludlam · Pull Request #1309 · ocaml/odoc · GitHub
  • Fix issue #610 - odoc html-fragment not producing headings correctly by jonludlam · Pull Request #1306 · ocaml/odoc · GitHub
  • Fix classify when there are archives sharing modules by jonludlam · Pull Request #1310 · ocaml/odoc · GitHub

We are happy to announce the release of ppxlib.0.36.0!

With this release, the internal AST that ppxlib targets has been bumped to the AST of OCaml 5.2. Ppx authors can now use features from OCaml 5.2. Ppxlib still supports any OCaml compiler after and including 4.08.0.

Many ppxes will be broken by changes made to the representation of functions. Authors are encouraged to read the upgrade guide.

See full changelog
  • Change Location.none to match the compiler's Location.none as of OCaml 4.08. This fixes a bug in loc_of_attribute (#540, @ncik-roberts, @patricoferris)

  • Bump ppxlib's AST to 5.2.0 (#514, @patricoferris)

  • Add the [@@@expand_inline] transformation and support for floating attribute context free transformations. (#560, @jaymody)

  • Add a -raise-embedded-errors flag to the driver. Setting this flag raises the first ocaml.error embedded in the final AST.

  • Export Ast_pattern.fail. (#563, @ceastlund)

  • Make Ast_traverse.sexp_of more concise, and add a test. (#561, @ceastlund)

We are happy to announce the release of ppxlib.0.35.0!

The main feature of this release is improved support for OCaml 5.3, allowing ppx users to have ppx rewriters operate on files with the new effect syntax.

Note that ppx-es and the effect syntax can cohabit but it is possible that ppx rewriters will error out if they encounter effect syntax node in their extension's payload or in the items they generate code from.

This feature also comes with a new --use-compiler-pp driver flag. This flag is required to preserve the effect syntax when the ppxlib driver outputs source code instead of marshalled AST. Note that the vast majority of users won't need to use this flag but it can come in handy in some more advanced use cases.

See full changelog
  • Allow use of effect syntax in preprocessed files without causing migration failures. (#552, @hhugo, @NathanReb)

  • Remove support for compilers older than 4.08 (#556, @NathanReb)

  • Add a --use-compiler-pp flag to the standalone driver. This flag can be set when the driver outputs source code to make it use the compiler's Pprintast instead of ppxlib's. (#555, @NathanReb)

Dune-release 2.1.0 has been released!

With this update,

  • A new commanddune-release delegate-info version has been added, which shows the current version of the package, as inferred by dune-release.
  • The dev-repo field in the .opam file can now be overridden using the --dev-repo flag on the commands dune-release and dune-release publish.
  • A bug related to decoding GitHub URLs has been fixed (FIXME:explain context and what's working now that wasn't before)
  • dune-release no longer publishes docs to github pages. This choice has been made because, as a consequence of publishing to opam-repository, the package documentation is built and served by ocaml.org/packages.
  • dune-release now works with the experimental package management feature from Dune Developer Preview.
See full changelog

Added

  • Add dune-release delegate-info version to show the current version as infered by the tool (#495, @samoht)
  • Add --dev-repo to dune-release and dune-release publish to overwrite the dev-repo field specified in the opam file (#494, @samoht)

Changed

  • Use the 'user' option as the fork owner, only attempt to decode the remote URL if the user option is not set. (#480, @Julow)

Fixed

  • Make dune-release not fail in the presence of ~/.dune/bin/dune (which is present when using dune package management)

Removed

  • dune-release no longer publishes docs to github pages. Instead, we rely on the docs published under ocaml.org/packages (#499 #500, @v-gb @samoht)

Dune 3.17.2

The Dune team is happy to announce the release of Dune 3.17.2!

This patch release includes some bug fixes. It brings some fixes for Melange and Wasm_of_ocaml. It also fixes a bug that prevents the experimental feature, package management, to build with ocaml.5.3.0.

See full changelog

Fixed

  • Fix a crash in the Melange rules that would prevent compiling public library implementations of virtual libraries. (@anmonteiro, #11248)
  • Pass melange.emit's compile_flags to the JS emission phase. (@anmonteiro, #11252)
  • Disallow private implementations of public virtual libs in melange mode. (@anmonteiro, #11253)
  • Wasm_of_ocaml: fix the execution of tests in a sandbox. (#11304, @vouillon)

We're happy to announce the release of Merlin 5.4.1-503!

See full changelog
  • ocaml-index
    • Bump magic number after index file format change (#1886)

We're pleased to announce the release of OCaml LSP Server 1.22.0, which enables experimental project-wide renaming of identifiers!

See full changelog

Features

  • Enable experimental project-wide renaming of identifiers (#1431)

Merlin 5.4-503 is now available with support for OCaml 5.3. This release leverages new features in OCaml 5.3 to improve locate behavior, resolving issues where Merlin previously confused unique identifiers from interfaces and implementations. The indexer has been optimized to perform fewer merges, and initial support for project-wide renaming has been added, allowing occurrences to return all usages of related definitions across a project.

The Vim plugin receives an enhancement with search-by-type functionality, accessible through the existing :MerlinSearch command. The command now automatically switches between search-by-type and polarity search based on the first character of the query.

See full changelog
  • merlin binary
    • Support for OCaml 5.3
    • Use new 5.3 features to improve locate behavior in some cases. Merlin no
      longer confuses uids from interfaces and implementations. (#1857)
    • Perform less merges in the indexer (#1881)
    • Add initial support for project-wide renaming: occurrences can now return
      all usages of all related definitions. (#1877)
  • vim plugin
    • Added support for search-by-type (#1846)
      This is exposed through the existing :MerlinSearch command, that
      switches between search-by-type and polarity search depending on the
      first character of the query.

OCaml LSP Server version 1.21.0 is now available. This release introduces a new server option called standardHover that allows clients to disable the default hover provider functionality.

See full changelog

Features

  • Add a new server option standardHover, that can be used by clients to
    disable the default hover provider. When standardHover = false
    textDocument/hover requests always returns with empty result. (#1416)

We’re happy to announce that we just released ppxlib.0.34.0.

The full patch notes are available on the release page over here.

The main features are OCaml 5.3 compatibility, new AST pretty-printing utilities and the ppxlib-tools package, support for [@@deriving ...] on class types and the addition of missing Pprintast entry points.

Changes summary

5.3 compatibility

ppxlib.0.34.0 is the first official ppxlib release that’s compatible with the new 5.3 compiler.

The ppxlib driver now also comes with a -keywords CLI option, similar to the compiler’s that allow you to compile and preprocess with the 5.3 compiler code that uses effect as an identifier. This is pretty niche but it’s there should you need it.

Please note that means you can use ppx-es with a 5.3 compiler but not that ppx-es can consume/produce 5.3 language features. We’re currently working on a fix allowing you to use the effect syntax in files that require preprocessing as it’s not possible with 0.34.0. The fix should be released in the next few days as 0.34.1.

AST pretty-printing

We added a new Pp_ast module that allows you to pretty print AST fragments.

The only way ppxlib would print ASTs before were as S-expressions. In practice we found that it was not always helpful and wanted a more readable and human friendly way of displaying the AST.

The default output of those printer is a simplified version of the AST to keep things clear and avoid cluttering the output with information that is not always useful. For example, if you run Ppxlib.Pp_ast.Default.expression on the AST for x + 2, you’ll get the following:

Pexp_apply
  ( Pexp_ident (Lident "+")
  , [ ( Nolabel, Pexp_ident (Lident "x"))
    ; ( Nolabel, Pexp_constant (Pconst_integer ( "2", None)))
    ]
  )

The alert reader will note that there are no locations or attributes and that the expression record layer is omitted here.

You can of course configure the printer to display more information if you need to.

We’ve been using these new printers internally to debug migration code and they have been a huge help so we hope they will make working with ppxlib easier for you too.

In addition to this new module, we also added a command line utility called ppxlib-pp-ast to pretty print ASTs from source files, source code fragments or even marshalled AST files. It is very similar to the old ppx_tools’s dumpast.

Note that it will print ppxlib’s internal AST after it’s been migrated from the installed compiler’s version. This is something that we could not simply achieve with OCaml’s own -dparsetree.

This should be a useful tool for debugging ppx related bugs or learning about the AST and we hope ppx authors and users will like it.

Other changes

As mentioned above, we also added some missing Pprintast* entries such as binding, longident and payload.

It is now possible to use [@@deriving ...] on class type declarations and therefore to write derivers for class types.

*: To the confused readers: Pprintast is entirely different from Pp_ast mentioned above as it prints the source code corresponding to a given AST.

Special thanks

We wanted to thank our external contributors for this release: @hhugo, @nojb and @dra27 for their help on the 5.3 compat and @mattiasdrp for bringing the Pprintast module up to speed.

Special thanks as well to @pedrobslisboa who started integrating their excellent ppx-by-example into ppxlib’s documentation.

Finally, I’d also like to thank the OCaml Software Foundation who’s been funding all my work on ppxlib and made this release possible!

Happy preprocessing to you all!

See full changelog
  • Add initial OCaml 5.3 support (#487, @NathanReb, @hhugo, @nojb)

  • Initialise OCaml 5.3's lexer with the keywords setting from OCAMLPARAM or the new -keywords driver's CLI option to allow the standalone ppx driver to process old packages using effect as an identifier (#535, @dra27, @NathanReb)

  • Add Pprintast.binding, longident and payload (#542, @mattiasdrp)

  • Fix deriving_inline round-trip check so that it works with 5.01 <-> 5.02 migrations (#519, @NathanReb)

  • Add ppxlib's AST pretty-printing utilities in Ppxlib.Pp_ast and a ppxlib-pp-ast executable in a new separate ppxlib-tools package (#517, #525, #537, @NathanReb)

  • Change -dparsetree from a sexp output to a pretty printed AST, closer to what the compiler's -dparsetree is. (#530, @NathanReb)

  • Add Parsetree documentation comments to Ast_builder functions (#518, @patricoferris)

  • Support class type declarations in derivers with the new, optional arguments {str,sig}_class_type_decl in Deriving.add (#538, @patricoferris)

We have the pleasure of announcing the release of OCaml version 5.3.0. dedicated to the memory of John William Mauchly and Paul Verlaine on the anniversary of their death.

De la musique avant toute chose, Et pour cela préfère l’Impair

(Music first and foremost of all! Choose your measure of odd not even)

Some of the highlights in OCaml 5.3.0 are:

  • Syntax for deep effect handlers

    There is now a dedicated syntax for installing deep effect handler

    match f () with
    | x -> x
    | effect Random_float, k -> Effect.Deep.continue k (Random.float 1.0)
    

    This new syntax adds a new effect keyword, which may break existing code. To improve backward compatibility, this new keyword can be disabled with the new -keywords flags if needed for backward compatibility.

  • Restored MSVC port

    It is now possible to use the MSVC toolchain on Windows, restoring the last missing port from OCaml 4 (except for the native compiler support for 32-bit architectures which is not planned)

  • Re-introduced statistical memory profiling (statmemprof)

    The submodule Gc.memprof is restored with a slightly different API. This submodule can be used to monitor memory allocation statistics inside a program. In OCaml 5, each domain can be monitored independently while child domains inherit the parent domain profiling profile (if there is one active).

  • utf-8 encoded Unicode source files and modest support of Unicode identifiers

    type saison = Hiver | Été | Printemps | Automne
    

    The OCaml lexer has been extended to support a modest subset of Unicode characters in identifiers. This is mostly intended for pedagogical use. This extended support requires source files to be utf-8 encoded Unicode text.

  • More space-efficient implementation of Dynarray

    The internal implementation of Dynarray now uses an unboxed representation which avoids the need of storing items wrapped in a Some x block and thus saves some spaces and indirections.

  • Improved metadata on the pairs of declarations and definitions for merlin.

    The metadata stored inside cmt files has been improved to better distinguish the provenance of identifiers (previous versions could confuse an interface and implementation identifier). Similarly, the metadata now tracks more precisely the association between declarations and definitions. For instance, in

    module X = struct let x = 0 end
    module M: sig
      val x: int
    end = struct
      let x = 1
      include X
    end
    

    Merlin can now determine that the definition of the M.x value lies inside the module X.

And a lot of incremental changes:

  • Around 20 new functions in the standard library (in the Domain, Dynarray Format, List, Queue, Sys, and Uchar modules).
  • Many fixes and improvements in the runtime
  • Improved error messages for first-class modules, functors, labelled arguments, and type clashes.
  • Numerous bug fixes

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 full changelog.


Installation Instructions

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

opam update
opam switch create 5.3.0

The source code for the release 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.3.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.3.0+flambda+nffa ocaml-variants.5.3.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 backend:

  • #12954: Restore the MSVC port (David Allsopp, Antonin Décimo, Samuel Hym, and Miod Vallat, review by Nicolás Ojeda Bär)

  • #13093: Allow building the MSVC port with clang-cl. (Antonin Décimo, review by Nicolás Ojeda Bär, Samuel Hym, David Allsopp and Sébastien Hinderer)

Language features:

  • #12309, #13158: Add syntax support for deep effect handlers (Leo White, Tom Kelly, Anil Madhavapeddy, KC Sivaramakrishnan, Xavier Leroy and Florian Angeletti, review by the same, Hugo Heuzard, and Ulysse Gérard)

  • #11736, #12664, #13628: Support utf-8 encoded source files and latin-9 compatible identifiers. (Xavier Leroy and Florian Angeletti, review by Daniel Bünzli and Jules Aguillon)

  • #12828, #13283: Add short syntax for dependent functor types (X:A) -> ... (Jeremy Yallop, review by Nicolás Ojeda Bär and Gabriel Scherer)

Type system

  • #11891, #12507: Allow to name new locally abstract types in constructor type annotations. (Jacques Garrigue, report and review by Gabriel Scherer and Florian Angeletti)

Runtime system:

  • #11911, #12923: Multicore statistical memory profiling. This restores a notable OCaml 4 feature that was missing in OCaml 5. (Nick Barnes, review by Stephen Dolan, Jacques-Henri Jourdan and Guillaume Munch-Maccagnoni).

  • #13419: Fix memory bugs in runtime events system. (B. Szilvasy and Nick Barnes, review by Miod Vallat, Nick Barnes, Tim McGilchrist, and Gabriel Scherer)

  • #13364: Emit major slice counters in the runtime events. (KC Sivaramakrishnan and Sadiq Jaffer, review by Gabriel Scherer)

  • #13382: Add more documentation for Runtime_events types (Sadiq Jaffer, review by Tim McGilchrist, Miod Vallat and KC Sivaramakrishnan)

  • #13370: Fix a low-probability crash when calling Gc.counters. (Demi Marie Obenour, review by Gabriel Scherer)

  • #13272: Allow maximum number of domains to be specified as a OCAMLRUNPARAM parameter. (KC Sivaramakrishnan, review by Guillaume Munch-Maccagnoni, Miod Vallat, Gabriel Scherer, David Allsopp, request by Zachary Yedidia).

  • #12579: OS-based Synchronisation for Stop-the-World Sections (B. Szilvasy, review by Miod Vallat, Nick Barnes, Olivier Nicole, Gabriel Scherer and Damien Doligez)

  • #12789: Restore caml_unregister_frametable from OCaml 4 (Frédéric Recoules, review by Gabriel Scherer)

  • #13003: new, more consistent names for array-creation C functions (Gabriel Scherer, review by Olivier Nicole)

  • #13013: introduce a caml_result type to supersede the use of 'encoded exception values' in the FFI. (Gabriel Scherer, review by Damien Doligez, Guillaume Munch-Maccagnoni and Xavier Leroy, suggested by Guillaume Munch-Maccagnoni)

  • #12407, #13226: Resource-handling improvements: add exception-returning variants for all exception-raising functions in caml/fail.h, for the purpose of cleaning-up state and resources before raising. (Guillaume Munch-Maccagnoni, review by Damien Doligez, Xavier Leroy and Gabriel Scherer)

  • #13086: Avoid spurious major GC slices. (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer and Stephen Dolan)

  • #11779, #13117: Improve logic for fiber stack alignment. (Miod Vallat, report by Damien Doligez, review by Gabriel Scherer)

  • #12839: Remove ATOMIC_UINTNAT_INIT from camlatomic.h (as part of a larger cleanup of camlatomic.h) (David Allsopp, review by Antonin Décimo, Sébastien Hinderer, Samuel Hym, Guillaume Munch-Maccagnoni and Miod Vallat)

  • #13163: Enable frame pointers on macOS x86_64 (Tim McGilchrist, review by Sébastien Hinderer and Fabrice Buoro)

  • #12951: Constify constructors and flags tables in C code (take 2). Now these tables will go in the readonly segment, where they belong. (Antonin Décimo, review by David Allsopp)

  • #10696: Introduce __has_attribute and __has_c_attributes in <caml/misc.h> to test the support of specific attributes in C code. Introduce fallthrough as a wrapper around the fallthrough attribute. (Antonin Décimo, review by Nicolás Ojeda Bär, Xavier Leroy, and Gabriel Scherer)

  • #13083: Use macros from limits.h to avoid signed-integer wrap-around. Introduce CAML_{U,}INTNAT_{MIN,MAX} macros to expose {u,}intnat limits. (Antonin Décimo, review by Nick Barnes, Xavier Leroy, Gabriel Scherer, and Miod Vallat)

  • #13239: Check whether the compiler supports the labels as values extension to enable threaded code interpretation. (Antonin Décimo, review by Miod Vallat)

  • #13238: Enable software prefetching on x86 and x86_64 when building with MSVC or clang-cl. (Antonin Décimo, review by Miod Vallat)

  • #13241, #13261, #13271: Add CFI_SIGNAL_FRAME to ARM64 and RiscV runtimes, for the purpose of displaying backtraces correctly in GDB. (Tim McGilchrist, review by Miod Vallat, Gabriel Scherer and KC Sivaramakrishnan)

  • #13139: Simplify CAMLalign to always use C23/C++11 alignas or C11 _Alignas. Ensures that stat data is always aligned to the best boundary. (Antonin Décimo, review by Miod Vallat and Xavier Leroy)

  • #13280: Check for support of compiler attributes. Allows using compiler attributes with clang-cl. (Antonin Décimo, review by Miod Vallat)

  • #13243: Enable C compiler warnings internally when building with clang-cl or MSVC. Provide fixes too. (Antonin Décimo, review by Miod Vallat and Xavier Leroy)

  • #13242: Define and use unreachable and trap annotation, and clean-up some runtime assertions. (Antonin Décimo, review by Miod Vallat, Gabriel Scherer, and David Allsopp)

  • #13402, #13512, #13549, #13553: Revise bytecode implementation of callbacks so that it no longer produces dangling registered bytecode fragments. (Xavier Leroy, report by Jan Midtgaard, analysis by Stephen Dolan, review by Miod Vallat)

  • #13407: Add Runtime_events.EV_EMPTY_MINOR (Thomas Leonard)

  • #13522: Confirm runtime events ring is still active after callback. (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat)

  • #13529: Do not write to event ring after going out of stw participant set. (KC Sivaramakrishnan, review by Sadiq Jaffer)

Code generation and optimizations:

  • #13014: Enable compile-time option -function-sections on all previously unsupported native backends (POWER, riscv64 and s390x) (Miod Vallat, review by Nicolás Ojeda Bär)

  • #7241, #12555, #13076, #13138, #13338, #13152, #13153, #13154: fix a soundness bug in the pattern-matching compiler when side-effects mutate the scrutinee during matching. (Gabriel Scherer, review by Nick Roberts)

  • #13341: a warning when the pattern-matching compiler pessimizes code because side-effects may mutate the scrutinee during matching. (This warning is disabled by default, as this rarely happens and its performance impact is typically not noticeable.) (Gabriel Scherer, review by Nick Roberts, Florian Angeletti and David Allsopp)

  • #13179: Fix evaluation of toplevel lets in classes containing local opens (Vincent Laviron, review by Hugo Heuzard, Nathanaëlle Courant and Gabriel Scherer)

  • #13543: Remove some String-Bytes conversion from the stdlib to behave better with js_of_ocaml (Hugo Heuzard, review by Gabriel Scherer)

Standard library:

  • #12885: move Dynarray to an unboxed representation (Gabriel Scherer, suggestions by Vincent Laviron, review by Olivier Nicole and Simon Cruanes, Yann Leray, Alain Frisch)

  • #12884: Add Queue.drop (Léo Andrès, review by Nicolás Ojeda Bär and Gabriel Scherer)

  • #13168: In Array.shuffle, clarify the code that validates the result of the user-supplied function rand, and improve the error message that is produced when this result is invalid. (François Pottier, review by Florian Angeletti, Daniel Bünzli and Gabriel Scherer)

  • #12133: Expose support for printing substrings in Format (Florian Angeletti, review by Daniel Bünzli, Gabriel Scherer and Nicolás Ojeda Bär)

  • #12869: Add List.take, List.drop, List.take_while and List.drop_while (Kate Deplaix and Oscar Butler-Aldridge, review by Nicolás Ojeda Bär, Craig Ferguson and Gabriel Scherer)

  • #13047: Add Sys.poll_actions to (only) run pending runtime actions. (Nick Barnes, review by Gabriel Scherer, Guillaume Munch-Maccagnoni, and Vincent Laviron)

  • #13144: Dynarray.{equal, compare} (Gabriel Scherer, review by Jeremy Yallop, Daniel Bünzli and Olivier Nicole, request by Olivier Nicole)

  • #13171: expose Domain.self_index : unit -> int (a somewhat-dense indexing of currently-running domains) for advanced use-cases of domain-indexed concurrent data structures. (Gabriel Scherer, review by KC Sivaramakrishnan, Miod Vallat and Nicolás Ojeda Bär, report by Vesa Karvonen)

  • #13197: Dynarray.blit, which allows to extend the destination dynarray (0 <= dst_pos <= dst_length). (Gabriel Scherer, report by Hazem Elmasry, review by Olivier Nicole, Hazem Elmasry and Nicolás Ojeda Bär)

  • (breaking change) #13240: Add Uchar.seeded_hash, Change Uchar.hash implementation. Previously, Uchar.hash was aliased to Uchar.to_int. If you need that behavior, change your module instantiation from eg module HT = Hashtbl.Make(Uchar) to
      module HT = Hashtbl.Make(struct
        ...
        let hash = Uchar.to_int
      end)
    
    If the current implementation is desired, and you have a hashtable module HT (produced with the Make functor) in persistent storage, use HT.rebuild to ensure it doesn't break when reading from or writing to buckets. (Hazem ElMasry, review by Gabriel Scherer and Nicolás Ojeda Bär)
  • #13318: Fix regression in GC alarms, and fix them for flambda. (Guillaume Munch-Maccagnoni, report by Benjamin Monate, review by Vincent Laviron and Gabriel Scherer)

  • #13296: Add mem, memq, find_opt, find_index, find_map and find_mapi to Dynarray. (Jake H, review by Gabriel Scherer and Florian Angeletti)

Other libraries:

  • #11996: release the dependency of dynlink on compilerlibs. (Sébastien Hinderer and Stephen Dolan, review by Damien Doligez and Hugo Heuzard)

  • #13326: Implement Unix.O_APPEND on windows. (Romain Beauxis, review by Miod Vallat, Gabriel Scherer and Antonin Décimo)

Tools:

  • #11716: ocamllex: mismatched parentheses and curly brackets are now caught by ocamllex, instead of causing invalid OCaml code to be generated. (Demi Marie Obenour, review by Damien Doligez and Xavier Leroy)

  • #12904: Run the testsuite with ThreadSanitizer on a PR when label run-thread-sanitizer is added (Olivier Nicole, suggested by Sébastien Hinderer and David Allsopp, review by Gabriel Scherer)

  • (breaking change) #13114: Support ocamldebug remote debugging over IPv6 on all platforms, and over Unix domain sockets on Windows. (Antonin Décimo, review by Gabriel Scherer and Miod Vallat)
  • #13136: Rewrite GDB extensions and macros in debugger-agnostic Python, and add LLDB support for them. (Nick Barnes, review by Tim McGilchrist and Gabriel Scherer)

Toplevel:

  • #12891: Improved styling for initial prompt (Florian Angeletti, review by Gabriel Scherer)

  • #13053: Improved display of builtin types such as _ list when aliased. (Samuel Vivien, review by Florian Angeletti)

Manual and documentation:

  • #13370: Document that that temporary variables holding GCd pointers must not be live across a GC. (Demi Marie Obenour)

  • #12298: Manual: emphasize that Bigarray.int refers to an OCaml integer, which does not match the C int type. (Edwin Török, review by Florian Angeletti)

  • #12868: Manual: simplify style colours of the post-processed manual and API HTML pages, and fix the search button icon (Yawar Amin, review by Simon Grondin, Gabriel Scherer, and Florian Angeletti)

  • #12949: document OCaml release cycles and version strings in release-info/introduction.md. (Florian Angeletti, review by Fabrice Buoro, Kate Deplaix, Damien Doligez, and Gabriel Scherer)

  • #12976: Manual: use webman//*.html and webman//api/ for OCaml.org HTML manual generation (Shakthi Kannan, review by Hannes Mehnert, and Florian Angeletti)

  • #13045: Emphasize caution about behaviour of custom block finalizers. (Nick Barnes)

  • #13216: document the new caml_result type in the FFI chapter of the manual. (Gabriel Scherer, review by Miod Vallat, Daniel Bünzli, Nick Barnes, Guillaume Munch-Maccagnoni and Antonin Décimo)

  • #13287: stdlib/sys.mli: Update documentation on Sys.opaque_identity following #9412. (Matt Walker, review by Guillaume Munch-Maccagnoni and Vincent Laviron)

  • #13295: Use syntax for deep effect handlers in the effect handlers manual page. (KC Sivaramakrishnan, review by Anil Madhavapeddy, Florian Angeletti and Miod Vallat)

  • #13424: Fix Gc.quick_stat documentation to clarify that returned fields live_words, live_blocks, free_words, and fragments are not zero. (Jan Midtgaard, review by Damien Doligez and KC Sivaramakrishnan)

  • #13440: Update documentation of Gc.{control,get,set} to reflect fields not currently supported on OCaml 5. (Jan Midtgaard, review by Gabriel Scherer)

  • #13469, #13474, #13535: Document that [Hashtbl.create n] creates a hash table with a default minimal size, even if [n] is very small or negative. (Antonin Décimo, Nick Bares, report by Nikolaus Huber and Jan Midtgaard, review by Florian Angeletti, Anil Madhavapeddy, Gabriel Scherer, and Miod Vallat)

  • #13666: Rewrite parts of the example code around nested lists in Chapter 6 (Polymorphism and its limitations -> Polymorphic recursion) giving the "depth" function [in the non-polymorphically-recursive part of the example] a much more sensible behavior; also fix a typo and some formatting. (Frank Steffahn, review by Florian Angeletti)

  • #13668: Document the basic support for unicode identifiers and the switch to UTF-8 encoded Unicode text for OCaml source file (Florian Angeletti, review by Nicolás Ojeda Bär and Daniel Bünzli)

Compiler user-interface and warnings:

  • (breaking change) #12084, #13669, #13673: Check link order when creating archive and when using ocamlopt. (Hugo Heuzard, review by Stefan Muenzel and Sébastien Hinderer)
  • #12980: Explain type mismatch involving first-class modules by including the module level error message (Florian Angeletti, review by Vincent Laviron)

  • #12985, #12988: Better error messages for partially applied functors. (Florian Angeletti, report by Arthur Wendling, review by Gabriel Scherer)

  • #13034, #13260: Better error messages for mismatched function labels (Florian Angeletti, report by Daniel Bünzli, review by Gabriel Scherer and Samuel Vivien)

  • #13051: Add a "Syntax error" to error messages for invalid package signatures. (Samuel Vivien, review by Gabriel Scherer)

  • #13099: Fix erroneous loading of cmis for some module type errors. (Nick Roberts, review by Florian Angeletti)

  • #13151, name conflicts explanation as a footnote (Florian Angeletti, review by Gabriel Scherer)

  • #13228: Re-export Cmt2annot.{iterator,binary_part} which had become hidden since #11288 and broke ocamlbrowser. (David Allsopp, report by Jacques Garrigue, review by Sébastien Hinderer)

  • #13251: Register printer for errors in Emitaux (Vincent Laviron, review by Miod Vallat and Florian Angeletti)

  • #13255: Re-enable warning 34 for unused locally abstract types (Nick Roberts, review by Chris Casinghino and Florian Angeletti)

  • #12182: Improve the type clash error message. For example, this message: This expression has type ... is changed into: The constant "42" has type ... (Jules Aguillon, review by Gabriel Scherer and Florian Angeletti)

  • #13471: add -keywords <version?+list> flag to define the list of keywords recognized by the lexer, for instance -keywords 5.2 disable the effect keyword. (Florian Angeletti, review by Gabriel Scherer)

Internal/compiler-libs changes:

  • #13286: Distinguish unique identifiers Shape.Uid.t according to their provenance: either an implementation or an interface. (Ulysse Gérard, review by Florian Angeletti and Leo White)

  • #13308: keep track of relations between declaration in the cmt files. This is useful information for external tools for navigation and analysis purposis. (Ulysse Gérard, Florian Angeletti, review by Florian Angeletti and Gabriel Scherer)

  • #11129, #11148: enforce that ppxs do not produce parsetrees with an empty list of universally quantified type variables (. int -> int instead of 'a . int -> int') (Florian Angeletti, report by Simmo Saan, review by Gabriel Scherer)

  • #12534: document and refactor Matching.mk_failaction_pos (Gabriel Scherer, review by Vincent Laviron and Nick Roberts)

  • #13076: change the handling of Match_failure exits in the pattern-matching compiler, to prepare for a complete fix for #7241 (Gabriel Scherer, review by Thomas Refis and Nick Roberts)

  • #12896: Simplify the compilation of custom bytecode runtimes by explicitly compiling the primitives file before calling the linker. Tidy-up both the generating code and the output itself for C code being generated by the bytecode linker in -custom and -output-* modes. (David Allsopp, Antonin Décimo and Samuel Hym, review by Vincent Laviron)

  • #12932: Remove useless code in Typecore.type_label_exp (was a fix for #4862) (Jacques Garrigue, review by Gabriel Scherer)

  • #12943: Make transient_expr.scope a bitfield, and use it to store marks. Marks are automatically allocated, and removed when leaving their scope. Falls back to using TransientTypeSet when marks are exhausted. (Jacques Garrigue and Takafumi Saikawa, review by Basile Clément)

  • #12946: Make generalization automatic when leaving scope. As a result, the Ctype.generalize* and Ctype.correct_levels functions were removed. The latter is now called Ctype.duplicate_type. (Jacques Garrigue and Takafumi Saikawa, review by Richard Eisenberg)

  • #12968: Attach location to constants in the parsetree (Jules Aguillon, review by Gabriel Scherer)

  • #12959, #13055: Avoid an internal error on recursive module type inconsistency (Florian Angeletti, review by Jacques Garrigue and Gabriel Scherer)

  • #13049: graphical debugging printer for types (Florian Angeletti, review by Gabriel Scherer)

  • #13074, #13082, #13084: refactoring in the pattern-matching compiler (Gabriel Scherer, review by Thomas Refis, Vincent Laviron and Nick Roberts)

  • #13067: rework volatile memory access rules under TSan to consider properly aligned smaller-than-register read operations as atomic, which gets rid of false positives on s390x (Miod Vallat, review by Fabien Buoro)

  • #13162: Use quoted strings to clarify code being generated. (Antonin Décimo, review by Miod Vallat and Gabriel Scherer)

  • #13015: Emit floating-point literals in .rodata section on ELF arm64 platforms (Linux, *BSD). (Miod Vallat, review by Nicolás Ojeda Bär)

  • #13169, #13311: Introduce a document data type for compiler messages rather than relying on Format.formatter -> unit closures. (Florian Angeletti, review by Gabriel Scherer)

  • #13193: Remove the unused env_init field from class blocks (Vincent Laviron, review by Jacques Garrigue)

  • #13257: integrate MetaOCaml in the Menhir grammar to ease MetaOCaml maintenance. This is a purely internal change: there is no support in the lexer, so no change to the surface OCaml grammar. (Oleg Kiselyov, Gabriel Scherer and Florian Angeletti, review by Jeremy Yallop)

  • #13289: Use C99 for loop to reduce the scope of the for loop iterator. (Antonin Décimo, review by Miod Vallat and Gabriel Scherer)

  • #13336: compiler-libs, split the Printtyp in three to only keep "user-friendly" functions in the Printtyp module. (Florian Angeletti, review by Gabriel Scherer)

  • #13361: split runtime/array.c functions to consistently expose uniform_array and floatarray versions, use floatarray versions in Float.Array. (Gabriel Scherer, review by Nicolás Ojeda Bär)

  • #13507: A small refactoring to [free_vars] to make it a bit faster by not allocating a list when the list is not necessary. (Richard Eisenberg, review by Jacques Garrigue)

Build system:

  • #12909: Reorganise how MKEXE_VIA_CC is built to make it correct for MSVC by grouping all the linker flags at the end of the C compiler commandline (David Allsopp and Samuel Hym, review by Nicolás Ojeda Bär)

  • #12992, #13009: Check that flexlink can be executed only when building in a native windows environment. (Romain Beauxis, review by David Allsopp and Sébastien Hinderer)

  • #12996: Only link with -lgcc_eh when available. (Romain Beauxis, review by David Allsopp and Miod Vallat)

  • (breaking change) #13200: Do not use CFLAGS for linking. (Sébastien Hinderer, review by Gabriel Scherer, Antonin Décimo, Miod Vallat and Samuel Hym)
  • #13201, #13244: Fix and speedup builds with TSan. (Sébastien Hinderer, review by Miod Vallat, Gabriel Scherer and Olivier Nicole)
  • (breaking change) #12578, #12589, #13322, #13519: Use configured CFLAGS and CPPFLAGS only during the build of the compiler itself. Do not use them when compiling third-party C sources through the compiler. Flags for compiling third-party C sources can still be specified at configure time in the COMPILER_{BYTECODE,NATIVE}_{CFLAGS,CPPFLAGS} configuration variables. (Sébastien Hinderer, report by William Hu, review by David Allsopp)

Bug fixes:

  • #12854: Add a test in the regression suite that flags the bug #12825. (Luc Maranget)

  • #12888: fix printing of uncaught exceptions in .cmo files passed on the command-line of the toplevel. (Nicolás Ojeda Bär, review by Florian Angeletti, report by Daniel Bünzli)

  • #12910, #12920: Fix an unsound interaction between first-class modules and polymorphic records by saving and restoring univar_pairs. (Stephen Dolan, review by Gabriel Scherer, report by Jeremy Yallop)

  • #12994: Remove un-used and unsafe caml_drop_continuation (Tim McGilchrist, reviewed by Gabriel Scherer and Miod Vallat)

  • #12963: Restore caml_runtime_parameters implementation. This primitive allows programs to query the runtime parameters supplied to an OCaml program. Implementation missing since OCaml 5.0. (Tim McGilchrist, reviewed by David Allsopp and Miod Vallat)

  • #13012: parsing: Fix dropped attributes after a '-' or '+' The syntax '-(1 [@foo])' was incorrectly parsed as '-1'. (Jules Aguillon, reviewed by Gabriel Scherer, report by Gabriel Scherer)

  • (breaking change) #13070: On Windows, when configured with bootstrapped flexdll, don't add +flexdll to the search path when -nostdlib is specified (which then means -L no longer gets passed to the system linker). (David Allsopp, review by Florian Angeletti)
  • #13089: Fix bug in runtime_events library which could result in garbled output under Windows. (B. Szilvasy, review by Nicolás Ojeda Bär and Miod Vallat)

  • #13088: A few type-checker behaviors look at a type to see if there are any labeled arguments in it. This sometimes required expansion, which could, in obscure scenarios, result in superfluous type errors. (Richard Eisenberg, review by Gabriel Scherer and Jacques Garrigue)

  • #13103: FreeBSD/amd64: properly annotate .o files with non-executable stack notes (Konstantin Belousov, review by Nicolás Ojeda Bär)

  • #13150: improve a transitive-closure computation algorithm in the flambda middle-end to avoid a compilation time blowup on Menhir-generated code (Florian Weimer, review by Gabriel Scherer and Pierre Chambart, report by Richard Jones)

  • #13166: Fix a MinGW/MSVC Sys.rename regression on renaming a parent directory to an empty child directory. (Jan Midtgaard, review by Antonin Décimo, Sébastien Hinderer, and David Allsopp)

  • #13185, #13192: Reject type-level module aliases on functor parameter inside signatures. (Jacques Garrigue, report by Richard Eisenberg, review by Florian Angeletti)

  • #13170: Fix a bug that would result in some floating alerts [@@@alert ...] incorrectly triggering Warning 53. (Nicolás Ojeda Bär, review by Chris Casinghino and Florian Angeletti)

  • #13203: Do not issue warning 53 if the compiler is stopping before attributes have been accurately marked. (Chris Casinghino, review by Florian Angeletti)

  • #13207: Be sure to reload the register caching the exception handler in caml_c_call and caml_c_call_stack_args, as its value may have been changed if the OCaml stack is expanded during a callback. (Miod Vallat, report by Vesa Karvonen, review by Gabriel Scherer and Xavier Leroy)

  • #13209: Fix configure test that checks whether ar supports @FILE arguments. (Nicolás Ojeda Bär, report by Boris D.)

  • #13221: Compute more accurate instruction sizes for branch relocation on POWER. (Miod Vallat, review by Gabriel Scherer)

  • #13252: Rework register assignment in the interpreter code on m68k on Linux, due to the %a5 register being used by Glibc. (Miod Vallat, report by Stéphane Glondu, review by Gabriel Scherer and Xavier Leroy)

  • #13247: Disable lib_unix/kill test for MacOS AMD64 with TSan, linking to llvm bug report causing infinite signal loops. (Tim McGilchrist, review by Olivier Nicole, Miod Vallat, Sébastien Hinderer and Gabriel Scherer)

  • #13234, #13267: Open runtime events file in read-write mode on armel (armv5) systems due to atomic operations limitations on that platform. (Stéphane Glondu, review by Miod Vallat and Vincent Laviron)

  • #13273: Fix a call to test in configure.ac that was causing errors when LDFLAGS contains several words. (Stéphane Glondu, review by Miod Vallat)

  • #13290: Fix uninitialized and out of bounds reads in runtime_events_consumer.c (Edwin Török, review by Miod Vallat and Antonin Décimo)

  • #13306: An algorithm in the type-checker that checks two types for equality could sometimes, in theory, return the wrong answer. This patch fixes the oversight. No known program triggers the bug. (Richard Eisenberg, review by Florian Angeletti)

  • #13400: Initialize th->signal_stack to avoid free of uninitialized data if the user calls caml_c_thread_unregister on the main thread. (Richard W.M. Jones, review by Guillaume Munch-Maccagnoni and Gabriel Scherer)

  • #13140: POWER back-end: fix issue with call to caml_call_realloc_stack from a DLL (Xavier Leroy, review by Miod Vallat)

  • #13263, #13560: fix printing true and false in toplevel and error messages (no more unexpected #true) (Florian Angeletti, report by Samuel Vivien, review by Gabriel Scherer)

  • #13388, #13540: raises an error message (and not an internal compiler error) when two local substitutions are incompatible (for instance module type S:=sig end type t:=(module S)) (Florian Angeletti, report by Nailen Matschke, review by Gabriel Scherer, and Leo White)

  • #13408: Fix misplaced debug runtime assertion triggerable by a race between domain exit and backup thread (Miod Vallat and Gabriel Scherer, report by Jan Midtgaard)

  • #13417: Filename.quote_command: fix handling of forward slashes in program path under Win32. (Nicolás Ojeda Bär, review by David Allsopp and Damien Doligez)

  • #13501: Regression on mutually recursive types caused by #12180. Resuscitate Typedecl.update_type. (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard Eisenberg and Gabriel Scherer)

  • #13502: Fix misindexing related to Gc.finalise_last that could prevent finalisers from being run. (Nick Roberts, review by Mark Shinwell)

  • #13495, #13514: Fix typechecker crash while typing objects (Jacques Garrigue, report by Nicolás Ojeda Bär, review by Nicolas Ojeda Bär, Gabriel Scherer, Stephen Dolan, Florian Angeletti)

  • #13391, #13551: fix a printing bug with -dsource when using raw literal inside a locally abstract type constraint (i.e. let f: type \#for. ... ) (Florian Angeletti, report by Nick Roberts, review by Richard Eisenberg)

  • #13520: Fix compilation of native-code version of systhreads. Bytecode fields were being included in the thread descriptors. (David Allsopp, review by Sébastien Hinderer and Miod Vallat)

  • #13541, #13591: Fix headers for C++ inclusion. (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix)

  • #13579, #13583: Unsoundness involving non-injective types + gadts (Jacques Garrigue, report by @v-gb, review by Richard Eisenberg and Florian Angeletti)

  • #13598: Falsely triggered warning 56 [unreachable-case] This was caused by unproper protection of the retyping function. (Jacques Garrigue, report by Tõivo Leedjärv, review by Florian Angeletti)

  • #13603, #13604: fix source printing in the presence of the escaped raw identifier \#mod. (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer)

We are excited to share the release of OCaml-LSP 1.20.1, which introduces powerful new features and vital bug fixes to improve your development workflow. The new typeSearch request allows you to find values by type signature or polarity, making it easier to locate the functionality you need. Configurable MerlinJump actions and the custom jump request give you more control over code navigation. On the bug fix side, we have tackled issues like file descriptor leaks, enhanced method completion, and cleaned up duplicate responses in selectionRange.

See full changelog

Features

  • Add custom ocamllsp/typeSearch request (#1369)
  • Make MerlinJump code action configurable (#1376)
  • Add custom ocamllsp/jump request (#1374)

Fixes

  • Deactivate the jump code actions by default. Clients can enable them with the merlinJumpCodeActions configuration option. Alternatively, a custom request is provided for ad hoc use of the feature. (#1411)
  • Fix FD leak in running external processes for preprocessing (#1349)
  • Fix prefix parsing for completion of object methods (#1363, fixes #1358)
  • Remove some duplicates in the selectionRange answers (#1368)

This release introduces Merlin 5.3-502, compatible with OCaml 5.2, and 4.18-414, compatible with OCaml 4.14. Key updates include EXCLUDE_QUERY_DIR for better file management, resolving exceptions in polarity search,

and stabilizing type-enclosing results. For users of 5.3-502, additional enhancements address path resolution issues, fixes jump to fun functionality, and ensure proper handling of occurrences from hidden source files.

See full changelog
  • merlin binary

    • Respect the EXCLUDE_QUERY_DIR configuration directive when looking for cmt files #1854
    • Fix exception in polarity search (#1858 fixes #1113)
    • Fix type-enclosing results instability. This reverts some overly aggressive deduplication that should be done on the client side. #1864
  • merlin binary (only in 5.3-502)

    • Fix occurrences bug in which relative paths in index files are resolved against the PWD rather than the SOURCE_ROOT #1855
    • Fix jump to fun targets not working (#1863, fixes #1862)
    • Fix occurrences not working when the definition comes from a hidden source file #1865

Dune 3.17.1

The Dune team is happy to announce the release of Dune 3.17.1!

This patch release includes some bug fixes. To reduce computing time, it does not build .cmxs files anymore when the (no_dynlink) stanza is used instead. This behavior also corrects the semantic of the (no_dynlink) stanza which was building but not installing .cmxs files. It does not try to build and install them anymore.

See full changelog

Fixed

  • When a library declares (no_dynlink), then the .cmxs file for it is no longer built. (#11176, @nojb)

  • Fix bug that could result in corrupted file copies by Dune, for example when using the copy_files# stanza or the copy# action. (@nojb, #11194, fixes #11193)

  • Remove useless error message when running $ dune subst in empty projects. (@rgrinberg, #11204, fixes #11200)

Odoc 2.4.4

We're happy to announce the release of Odoc 2.4.4 which brings compatibility with OCaml 5.3!

See full changelog

Added

After almost a year of work, OCamlformat 0.27.0 is finally available with support for 5.3 syntax!

This release includes the new function syntax from OCaml 5.2, the effect keyword from OCaml 5.3 and a large number of bug fixes and improvements.

An other notable change, is that comments are now formatted by default.

See full changelog

Highlight

  • * Support OCaml 5.2 syntax (#2519, #2544, #2590, #2596, #2621, #2628, @Julow, @EmileTrotignon, @hhugo) This includes local open in types, raw identifiers, and the new representation for functions. This might change the formatting of some functions due to the formatting code being completely rewritten.

  • Support OCaml 5.3 syntax (#2609, #2610, #2611, #2622, #2623, #2562, #2624, #2625, #2627, @Julow, @Zeta611) This adds support for effect patterns, short functor type arguments and utf8 identifiers. To format code using the new effect syntax, add this option to your .ocamlformat:

    ocaml-version = 5.3
    
  • Documentation comments are now formatted by default (#2390, @Julow) Use the option parse-docstrings = false to restore the previous behavior.

  • * Consistent indentation of polymorphic variant arguments (#2427, @Julow) Increases the indentation by one to make the formatting consistent with normal variants. For example:

      ...
      (* before *)
        (`Msg
          (foo bar))
      (* after *)
        (`Msg
           (foo bar))
    
  • Build on OCaml 5.3 (#2603, @adamchol, @Julow)

Added

  • Improve the emacs plugin (#2577, #2600, @gridbugs, @thibautbenjamin) Allow a custom command to be used to run ocamlformat and add compatibility with emacs ocaml tree-sitter modes.

  • Added option let-binding-deindent-fun (#2521, @henrytill) to control the indentation of the fun in:

    let f =
     fun foo ->
      bar
    
  • Added back the flag --disable-outside-detected-project (#2439, @gpetiot) It was removed in version 0.22.

  • Support newer Odoc syntax (#2631, #2632, #2633, @Julow)

Changed

  • * Consistent formatting of comments (#2371, #2550, @Julow) This is mostly an internal change but some comments might be formatted differently.

  • * Improve formatting of type constraints with type variables (#2437, @gpetiot) For example:

    let f : type a b c.
        a -> b -> c =
      ...
    
  • * Improve formatting of functor arguments (#2505, @Julow) This also reduce the indentation of functor arguments with long signatures.

  • Improvements to the Janestreet profile (#2445, #2314, #2460, #2593, #2612, @Julow, @tdelvecchio-jsc)

  • * Undo let-bindings and methods normalizations (#2523, #2529, @gpetiot) This remove the rewriting of some forms of let-bindings and methods:

    • let f x = (x : int) is no longer rewritten into let f x : int = x
    • let f (type a) (type b) ... is no longer rewritten into let f (type a b) ...
    • let f = fun x -> ... is no longer rewritten into let f x = ...
  • * The break-colon option is now taken into account for method type constraints (#2529, @gpetiot)

  • * Force a break around comments following an infix operator (fix non-stabilizing comments) (#2478, @gpetiot) This adds a line break:

      a
      ||
      (* this comment is now on its own line *)
      b
    

Fixed

  • Fix placement of comments in some cases (#2471, #2503, #2506, #2540, #2541, #2592, #2617, @gpetiot, @Julow) Some comments were being moved or causing OCamlformat to crash. OCamlformat refuses to format if a comment would be missing in its output, to avoid loosing code.
  • Fix attributes being dropped or moved (#2247, #2459, #2551, #2564, #2602, @EmileTrotignon, @tdelvecchio-jsc, @Julow) OCamlformat refuses to format if the formatted code has a different meaning than the original code, for example, if an attribute is removed. We also try to avoid moving attributes even if that doesn't change the original code, for example we no longer format open[@attr] M as open M [@@attr].
  • Remove trailing space inside a wrapping empty signature (#2443, @Julow)
  • Fix extension-point spacing in structures (#2450, @Julow)
  • * Consistent break after string constant argument (#2453, @Julow)
  • * Fix cinaps comment formatting to not change multiline string contents (#2463, @tdelvecchio-jsc)
  • * Fix the indentation of tuples in attributes and extensions (#2488, @Julow)
  • * Fix weird indentation and line breaks after comments (#2507, #2589, #2606, @Julow)
  • * Fix unwanted alignment in if-then-else (#2511, @Julow)
  • Fix missing parentheses around constraint expressions with attributes (#2513, @alanechang)
  • Fix formatting of type vars in GADT constructors (#2518, @Julow)
  • Fix [@ocamlformat "disable"] in some cases (#2242, #2525, @EmileTrotignon) This caused a bug inside class type constructs and when attached to a let ... in
  • Display a##b instead of a ## b and similarly for operators that start with # (#2580, @v-gb)
  • * Fix arrow type indentation with break-separators=before (#2598, @Julow)
  • Fix missing parentheses around a let in class expressions (#2599, @Julow)
  • Fix formatting of paragraphs in lists in documentation (#2607, @Julow)
  • Avoid unwanted space in references and links text in documentation (#2608, @Julow)
  • * Improve the indentation of attributes in patterns (#2613, @Julow)
  • * Avoid large indentation in patterns after let%ext (#2615, @Julow)
If you want to contribute to a new release announcement, check out the Contributing Guide on GitHub.