From 6753e7e3797d89b577e03fb963a6725dac2d97fc Mon Sep 17 00:00:00 2001 From: Florian Angeletti Date: Thu, 9 Jan 2025 08:04:39 +0100 Subject: [PATCH] Release page and changelog for OCaml 5.3.0 (#2905) * fix date format from merlin changelog * changelog and release: OCaml 5.3.0 * Extended highlight description * Arthur Symons' translation of Verlaine verses --- ...2024-12-23-merlin-5.3.502-and-4.18.414.md} | 0 .../changelog/ocaml/2025-01-08-ocaml-5.3.0.md | 807 +++++++++++++++++ data/releases/5.2.1.md | 2 +- data/releases/5.3.0.md | 839 ++++++++++++++++++ 4 files changed, 1647 insertions(+), 1 deletion(-) rename data/changelog/merlin/{2024-23-12-merlin-5.3.502-and-4.18.414.md => 2024-12-23-merlin-5.3.502-and-4.18.414.md} (100%) create mode 100644 data/changelog/ocaml/2025-01-08-ocaml-5.3.0.md create mode 100644 data/releases/5.3.0.md diff --git a/data/changelog/merlin/2024-23-12-merlin-5.3.502-and-4.18.414.md b/data/changelog/merlin/2024-12-23-merlin-5.3.502-and-4.18.414.md similarity index 100% rename from data/changelog/merlin/2024-23-12-merlin-5.3.502-and-4.18.414.md rename to data/changelog/merlin/2024-12-23-merlin-5.3.502-and-4.18.414.md diff --git a/data/changelog/ocaml/2025-01-08-ocaml-5.3.0.md b/data/changelog/ocaml/2025-01-08-ocaml-5.3.0.md new file mode 100644 index 0000000000..7b73ec9676 --- /dev/null +++ b/data/changelog/ocaml/2025-01-08-ocaml-5.3.0.md @@ -0,0 +1,807 @@ +--- +title: Release of OCaml 5.3.0 +description: Release of OCaml 5.3.0 +tags: [ocaml] +changelog: | + (Changes that can break existing programs are marked with a "*") + ### Restored backend: + + - [#12954](https://github.com/ocaml/ocaml/issues/12954): Restore the MSVC port + (David Allsopp, Antonin Décimo, Samuel Hym, and Miod Vallat, review by Nicolás + Ojeda Bär) + + - [#13093](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12309), [#13158](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11736), [#12664](https://github.com/ocaml/ocaml/issues/12664), [#13628](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12828), [#13283](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11891), [#12507](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11911), [#12923](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13364): Emit major slice counters in the runtime events. + (KC Sivaramakrishnan and Sadiq Jaffer, review by Gabriel Scherer) + + - [#13382](https://github.com/ocaml/ocaml/issues/13382): Add more documentation for Runtime_events types + (Sadiq Jaffer, review by Tim McGilchrist, Miod Vallat and KC Sivaramakrishnan) + + - [#13370](https://github.com/ocaml/ocaml/issues/13370): Fix a low-probability crash when calling Gc.counters. + (Demi Marie Obenour, review by Gabriel Scherer) + + - [#13272](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12789): Restore caml_unregister_frametable from OCaml 4 + (Frédéric Recoules, review by Gabriel Scherer) + + - [#13003](https://github.com/ocaml/ocaml/issues/13003): new, more consistent names for array-creation C functions + (Gabriel Scherer, review by Olivier Nicole) + + - [#13013](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12407), [#13226](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13086): Avoid spurious major GC slices. + (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer + and Stephen Dolan) + + - [#11779](https://github.com/ocaml/ocaml/issues/11779), [#13117](https://github.com/ocaml/ocaml/issues/13117): Improve logic for fiber stack alignment. + (Miod Vallat, report by Damien Doligez, review by Gabriel Scherer) + + - [#12839](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13163): Enable frame pointers on macOS x86_64 + (Tim McGilchrist, review by Sébastien Hinderer and Fabrice Buoro) + + - [#12951](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/10696): Introduce __has_attribute and __has_c_attributes in + to test the support of specific atributes 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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13239): Check whether the compiler supports the labels as values + extension to enable threaded code interpretation. + (Antonin Décimo, review by Miod Vallat) + + - [#13238](https://github.com/ocaml/ocaml/issues/13238): Enable software prefetching on x86 and x86_64 when building + with MSVC or clang-cl. + (Antonin Décimo, review by Miod Vallat) + + - [#13241](https://github.com/ocaml/ocaml/issues/13241), [#13261](https://github.com/ocaml/ocaml/issues/13261), [#13271](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13280): Check for support of compiler attributes. Allows using + compiler attributes with clang-cl. + (Antonin Décimo, review by Miod Vallat) + + - [#13243](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13402), [#13512](https://github.com/ocaml/ocaml/issues/13512), [#13549](https://github.com/ocaml/ocaml/issues/13549), [#13553](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13407): Add Runtime_events.EV_EMPTY_MINOR + (Thomas Leonard) + + - [#13522](https://github.com/ocaml/ocaml/issues/13522): Confirm runtime events ring is still active after callback. + (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat) + + - [#13529](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/7241), [#12555](https://github.com/ocaml/ocaml/issues/12555), [#13076](https://github.com/ocaml/ocaml/issues/13076), [#13138](https://github.com/ocaml/ocaml/issues/13138), [#13338](https://github.com/ocaml/ocaml/issues/13338), [#13152](https://github.com/ocaml/ocaml/issues/13152), [#13153](https://github.com/ocaml/ocaml/issues/13153), [#13154](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13179): Fix evaluation of toplevel lets in classes containing + local opens + (Vincent Laviron, review by Hugo Heuzard, Nathanaëlle Courant + and Gabriel Scherer) + + - [#13543](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12884): Add `Queue.drop` + (Léo Andrès, review by Nicolás Ojeda Bär and Gabriel Scherer) + + - [#13168](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12133): Expose support for printing substrings in Format + (Florian Angeletti, review by Daniel Bünzli, Gabriel Scherer + and Nicolás Ojeda Bär) + + - [#12869](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13047): Add Sys.poll_actions to (only) run pending runtime actions. + (Nick Barnes, review by Gabriel Scherer, Guillaume Munch-Maccagnoni, and + Vincent Laviron) + + - [#13144](https://github.com/ocaml/ocaml/issues/13144): Dynarray.{equal, compare} + (Gabriel Scherer, + review by Jeremy Yallop, Daniel Bünzli and Olivier Nicole, + request by Olivier Nicole) + + - [#13171](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11996): release the dependency of dynlink on compilerlibs. + (Sébastien Hinderer and Stephen Dolan, review by Damien Doligez and + Hugo Heuzard) + + - [#13326](https://github.com/ocaml/ocaml/issues/13326): Implement Unix.O_APPEND on windows. + (Romain Beauxis, review by Miod Vallat, Gabriel Scherer and Antonin Décimo) + + ### Tools: + + - [#11716](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12891): Improved styling for initial prompt + (Florian Angeletti, review by Gabriel Scherer) + + - [#13053](https://github.com/ocaml/ocaml/issues/13053): Improved display of builtin types such as `_ list` when aliased. + (Samuel Vivien, review by Florian Angeletti) + + ### Manual and documentation: + + - [#13370](https://github.com/ocaml/ocaml/issues/13370): Document that that temporary variables holding GCd pointers must + not be live across a GC. + (Demi Marie Obenour) + + - [#12298](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12976): Manual: use webman//*.html and + webman//api/ for OCaml.org HTML manual generation + (Shakthi Kannan, review by Hannes Mehnert, and Florian Angeletti) + + - [#13045](https://github.com/ocaml/ocaml/issues/13045): Emphasize caution about behaviour of custom block finalizers. + (Nick Barnes) + + - [#13216](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13287): stdlib/sys.mli: Update documentation on Sys.opaque_identity + following [#9412](https://github.com/ocaml/ocaml/issues/9412). + (Matt Walker, review by Guillaume Munch-Maccagnoni and Vincent Laviron) + + - [#13295](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13440): Update documentation of `Gc.{control,get,set}` to reflect fields + not currently supported on OCaml 5. + (Jan Midtgaard, review by Gabriel Scherer) + + - [#13469](https://github.com/ocaml/ocaml/issues/13469), [#13474](https://github.com/ocaml/ocaml/issues/13474), [#13535](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12084), [#13669](https://github.com/ocaml/ocaml/issues/13669), [#13673](https://github.com/ocaml/ocaml/issues/13673): Check link order when creating archive and when using + ocamlopt. + (Hugo Heuzard, review by Stefan Muenzel and Sébastien Hinderer) + + - [#12980](https://github.com/ocaml/ocaml/issues/12980): Explain type mismatch involving first-class modules by including + the module level error message + (Florian Angeletti, review by Vincent Laviron) + + - [#12985](https://github.com/ocaml/ocaml/issues/12985), [#12988](https://github.com/ocaml/ocaml/issues/12988): Better error messages for partially applied functors. + (Florian Angeletti, report by Arthur Wendling, review by Gabriel Scherer) + + - [#13034](https://github.com/ocaml/ocaml/issues/13034), [#13260](https://github.com/ocaml/ocaml/issues/13260): Better error messages for mismatched function labels + (Florian Angeletti, report by Daniel Bünzli, review by Gabriel Scherer and + Samuel Vivien) + + - [#13051](https://github.com/ocaml/ocaml/issues/13051): Add a "Syntax error" to error messages for invalid package signatures. + (Samuel Vivien, review by Gabriel Scherer) + + - [#13099](https://github.com/ocaml/ocaml/issues/13099): Fix erroneous loading of cmis for some module type errors. + (Nick Roberts, review by Florian Angeletti) + + - [#13151](https://github.com/ocaml/ocaml/issues/13151), name conflicts explanation as a footnote + (Florian Angeletti, review by Gabriel Scherer) + + - [#13228](https://github.com/ocaml/ocaml/issues/13228): Re-export Cmt2annot.{iterator,binary_part} which had become hidden + since [#11288](https://github.com/ocaml/ocaml/issues/11288) and broke ocamlbrowser. + (David Allsopp, report by Jacques Garrigue, review by Sébastien Hinderer) + + - [#13251](https://github.com/ocaml/ocaml/issues/13251): Register printer for errors in Emitaux + (Vincent Laviron, review by Miod Vallat and Florian Angeletti) + + - [#13255](https://github.com/ocaml/ocaml/issues/13255): Re-enable warning 34 for unused locally abstract types + (Nick Roberts, review by Chris Casinghino and Florian Angeletti) + + - [#12182](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13471): add `-keywords ` 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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11129), [#11148](https://github.com/ocaml/ocaml/issues/11148): enforce that ppxs do not produce `parsetree`s 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](https://github.com/ocaml/ocaml/issues/12534): document and refactor Matching.mk_failaction_pos + (Gabriel Scherer, review by Vincent Laviron and Nick Roberts) + + - [#13076](https://github.com/ocaml/ocaml/issues/13076): change the handling of Match_failure exits in the pattern-matching + compiler, to prepare for a complete fix for [#7241](https://github.com/ocaml/ocaml/issues/7241) + (Gabriel Scherer, review by Thomas Refis and Nick Roberts) + + - [#12896](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12932): Remove useless code in Typecore.type_label_exp (was a fix for [#4862](https://github.com/ocaml/ocaml/issues/4862)) + (Jacques Garrigue, review by Gabriel Scherer) + + - [#12943](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12968): Attach location to constants in the parsetree + (Jules Aguillon, review by Gabriel Scherer) + + - [#12959](https://github.com/ocaml/ocaml/issues/12959), [#13055](https://github.com/ocaml/ocaml/issues/13055): Avoid an internal error on recursive module type inconsistency + (Florian Angeletti, review by Jacques Garrigue and Gabriel Scherer) + + - [#13049](https://github.com/ocaml/ocaml/issues/13049): graphical debugging printer for types + (Florian Angeletti, review by Gabriel Scherer) + + - [#13074](https://github.com/ocaml/ocaml/issues/13074), [#13082](https://github.com/ocaml/ocaml/issues/13082), [#13084](https://github.com/ocaml/ocaml/issues/13084): refactoring in the pattern-matching compiler + (Gabriel Scherer, review by Thomas Refis, Vincent Laviron and Nick Roberts) + + - [#13067](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13162): Use quoted strings to clarify code being generated. + (Antonin Décimo, review by Miod Vallat and Gabriel Scherer) + + - [#13015](https://github.com/ocaml/ocaml/issues/13015): Emit floating-point literals in .rodata section on ELF arm64 + platforms (Linux, *BSD). + (Miod Vallat, review by Nicolás Ojeda Bär) + + - [#13169](https://github.com/ocaml/ocaml/issues/13169), [#13311](https://github.com/ocaml/ocaml/issues/13311): Introduce a document data type for compiler messages + rather than relying on `Format.formatter -> unit` closures. + (Florian Angeletti, review by Gabriel Scherer) + + - [#13193](https://github.com/ocaml/ocaml/issues/13193): Remove the unused env_init field from class blocks + (Vincent Laviron, review by Jacques Garrigue) + + - [#13257](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12992), [#13009](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12996): Only link with -lgcc_eh when available. + (Romain Beauxis, review by David Allsopp and Miod Vallat) + + * (*breaking change*) [#13200](https://github.com/ocaml/ocaml/issues/13200): Do not use CFLAGS for linking. + (Sébastien Hinderer, review by Gabriel Scherer, Antonin Décimo, + Miod Vallat and Samuel Hym) + + - [#13201](https://github.com/ocaml/ocaml/issues/13201), [#13244](https://github.com/ocaml/ocaml/issues/13244): Fix and speedup builds with TSan. + (Sébastien Hinderer, review by Miod Vallat, Gabriel Scherer and + Olivier Nicole) + + * (*breaking change*) [#12578](https://github.com/ocaml/ocaml/issues/12578), [#12589](https://github.com/ocaml/ocaml/issues/12589), [#13322](https://github.com/ocaml/ocaml/issues/13322), [#13519](https://github.com/ocaml/ocaml/issues/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) + + - [#13285](https://github.com/ocaml/ocaml/issues/13285): continue the merge of the sub-makefiles into the root + Makefile started with [#11243](https://github.com/ocaml/ocaml/issues/11243), [#11248](https://github.com/ocaml/ocaml/issues/11248), [#11268](https://github.com/ocaml/ocaml/issues/11268), [#11420](https://github.com/ocaml/ocaml/issues/11420), [#11675](https://github.com/ocaml/ocaml/issues/11675), + [#12198](https://github.com/ocaml/ocaml/issues/12198), [#12321](https://github.com/ocaml/ocaml/issues/12321), [#12586](https://github.com/ocaml/ocaml/issues/12586), [#12616](https://github.com/ocaml/ocaml/issues/12616), [#12706](https://github.com/ocaml/ocaml/issues/12706) and [#13048](https://github.com/ocaml/ocaml/issues/13048). + (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) + + ### Bug fixes: + + - [#12854](https://github.com/ocaml/ocaml/issues/12854): Add a test in the regression suite that flags the bug [#12825](https://github.com/ocaml/ocaml/issues/12825). + (Luc Maranget) + + - [#12888](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12910), [#12920](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12994): Remove un-used and unsafe caml_drop_continuation + (Tim McGilchrist, reviewed by Gabriel Scherer and Miod Vallat) + + - [#12963](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13103): FreeBSD/amd64: properly annotate .o files with non-executable stack + notes (Konstantin Belousov, review by Nicolás Ojeda Bär) + + - [#13150](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13185), [#13192](https://github.com/ocaml/ocaml/issues/13192): Reject type-level module aliases on functor parameter + inside signatures. + (Jacques Garrigue, report by Richard Eisenberg, review by Florian Angeletti) + + - [#13170](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13203): Do not issue warning 53 if the compiler is stopping before attributes + have been accurately marked. + (Chris Casinghino, review by Florian Angeletti) + + - [#13207](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13209): Fix configure test that checks whether `ar` supports `@FILE` + arguments. + (Nicolás Ojeda Bär, report by Boris D.) + + - [#13221](https://github.com/ocaml/ocaml/issues/13221): Compute more accurate instruction sizes for branch relocation on + POWER. + (Miod Vallat, review by Gabriel Scherer) + + - [#13252](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13234), [#13267](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13140): POWER back-end: fix issue with call to `caml_call_realloc_stack` + from a DLL + (Xavier Leroy, review by Miod Vallat) + + - [#13263](https://github.com/ocaml/ocaml/issues/13263), [#13560](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13388), [#13540](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13501): Regression on mutually recursive types caused by [#12180](https://github.com/ocaml/ocaml/issues/12180). + Resuscitate Typedecl.update_type. + (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard + Eisenberg and Gabriel Scherer) + + - [#13502](https://github.com/ocaml/ocaml/issues/13502): Fix misindexing related to `Gc.finalise_last` that could prevent + finalisers from being run. + (Nick Roberts, review by Mark Shinwell) + + - [#13495](https://github.com/ocaml/ocaml/issues/13495), [#13514](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13391), [#13551](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13541), [#13591](https://github.com/ocaml/ocaml/issues/13591): Fix headers for C++ inclusion. + (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix) + + - [#13579](https://github.com/ocaml/ocaml/issues/13579), [#13583](https://github.com/ocaml/ocaml/issues/13583): Unsoundness involving non-injective types + gadts + (Jacques Garrigue, report by @v-gb, + review by Richard Eisenberg and Florian Angeletti) + + - [#13598](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13603), [#13604](https://github.com/ocaml/ocaml/issues/13604): fix source printing in the presence of the escaped raw + identifier `\#mod`. + (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer) +--- + +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 +```ocaml + match f () with + | x -> x + | effect Random_float, k -> Effect.Deep.continue k (Random.float 1.0) +``` + +- 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 makes it possible 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 + +```ocaml +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 version could confuse an interface and implementation identifier). Similarly, the metadata now tracks more precisely the association between declaration and definitions. For instance, in + ```ocaml + 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](https://github.com/ocaml/ocaml/issues) +and post any questions or comments you might have on our +[discussion forums](https://discuss.ocaml.org). + + +The full list of changes can be found in the changelog below. + +--- + +## Installation Instructions + +The base compiler can be installed as an opam switch with the following commands: +```bash +opam update +opam switch create 5.3.0 +``` + +The source code for the release candidate is also directly available on: + +* [GitHub](https://github.com/ocaml/ocaml/archive/5.3.0.tar.gz) +* [OCaml archives at Inria](https://caml.inria.fr/pub/distrib/ocaml-5.3/ocaml-5.3.0.tar.gz) + +### Fine-Tuned Compiler Configuration + +If you want to tweak the configuration of the compiler, you can switch to the option variant with: +```bash +opam update +opam switch create ocaml-variants.5.3.0+options +``` +where `` is a space separated list of `ocaml-option-*` packages. For instance, for a `flambda` and `no-flat-float-array` switch: +```bash +opam switch create 5.3.0+flambda+nffa ocaml-variants.5.0.0+options ocaml-option-flambda ocaml-option-no-flat-float-array +``` diff --git a/data/releases/5.2.1.md b/data/releases/5.2.1.md index 63b8d7bfdd..c0493e2a5e 100644 --- a/data/releases/5.2.1.md +++ b/data/releases/5.2.1.md @@ -2,7 +2,7 @@ kind: compiler version: 5.2.1 date: 2024-11-18 -is_latest: true +is_latest: false intro: | This page describes OCaml version **5.2.1**, released on Nov 18, 2024. Go [here](/releases) for a list of all releases. diff --git a/data/releases/5.3.0.md b/data/releases/5.3.0.md new file mode 100644 index 0000000000..0c4f251df6 --- /dev/null +++ b/data/releases/5.3.0.md @@ -0,0 +1,839 @@ +--- +kind: compiler +version: 5.3.0 +date: 2025-01-08 +is_latest: true +intro: | + This page describes OCaml version **5.3.0**, released on + 2025-01-08. Go [here](/releases) for a list of all releases. + + This release is available as an [opam](/p/ocaml/5.3.0) package. +highlights: | + - Syntax for deep effect handlers + - Restored MSVC port + - Re-introduced statistical memory profiling + - More space-efficient implementation of Dynarray + - utf-8 encoded Unicode source files and modest support of Unicode identifiers + - Improved metadata on the pairs of declarations and definitions for merlin. + - Around 20 new functions in the standard library + - Many fixes and improvements in the runtime + - Improved error messages for first-class modules, functors, labeled arguments, + type clashes. + - Numerous bug fixes +--- + +## What's New + +Some of the highlights in OCaml 5.3.0 are: + +- Syntax for deep effect handlers +- Restored MSVC port +- Re-introduced statistical memory profiling +- More space-efficient implementation of Dynarray +- utf-8 encoded Unicode source files and modest support of Unicode identifiers +- Improved metadata on the pairs of declarations and definitions for merlin. + +And a lot of incremental changes: + +- Around 20 new functions in the standard library +- Many fixes and improvements in the runtime +- Improved error messages for first-class modules, functors, labeled arguments, +type clashes. +- Numerous bug fixes + +For a comprehensive list of changes and details on all new features, +bug fixes, optimisations, etc., please consult the +[changelog](#Changes). + +--- + +## Installation Instructions + +The base compiler can be installed as an opam switch with the following commands: +```bash +opam update +opam switch create 5.3.0 +``` + +The source code for OCaml 5.3.0 is also directly available on: + +* [GitHub](https://github.com/ocaml/ocaml/archive/5.3.0.tar.gz) +* [OCaml archives at Inria](https://caml.inria.fr/pub/distrib/ocaml-5.3/ocaml-5.3.0.tar.gz) + + +### Configuration Options + +The configuration of the installed [opam](https://opam.ocaml.org/) switch can be tuned with the +following options: + +- `ocaml-option-afl`: Set OCaml to be compiled with `afl-fuzz` instrumentation +- `ocaml-option-bytecode-only`: Compile OCaml without the native-code compiler +- `ocaml-option-flambda`: Set OCaml to be compiled with `flambda` activated +- `ocaml-option-musl`: Set OCaml to be compiled with `musl-gcc` +- `ocaml-option-no-flat-float-array`: Set OCaml to be compiled with `--disable-flat-float-array` +- `ocaml-option-static`: Set OCaml to be compiled with `musl-gcc -static` +- `ocaml-option-tsan` : Set OCaml to be compiled with thread sanitiser support +- `ocaml-option-address-sanitizer`: Set OCaml to be compiled with address sanitiser +- `ocaml-option-leak-sanitizer`: Set OCaml to be compiled with leak sanitiser +- `ocaml-option-fp`: Set OCaml to be compiled with frame pointers + +For instance, one can install a switch with both `flambda` and the `--disable-flat-float-array` option with + + +``` +opam switch create 5.3.0+flambda+nffa ocaml-variants.5.3.0+options ocaml-option-flambda ocaml-option-no-flat-float-array +``` + + +Source Distribution +------------------- + +- [Source + tarball](https://github.com/ocaml/ocaml/archive/5.3.0.tar.gz) + (`.tar.gz`) for compilation under Unix (including Linux and macOS X) + and Microsoft Windows (including Cygwin) +- Also available in + [`.zip`](https://github.com/ocaml/ocaml/archive/5.3.0.zip) + format +- [Opam](https://opam.ocaml.org/) is a source-based distribution of + OCaml and many companion libraries and tools. Compilation and + installation are automated by powerful package managers. +- The official development repo is hosted on + [GitHub](https://github.com/ocaml/ocaml). + +The +[INSTALL](https://ocaml.org/releases/5.3/notes/INSTALL.adoc) file +of the distribution provides detailed compilation and installation +instructions. See also the [Windows release +notes](https://ocaml.org/releases/5.3/notes/README.win32.adoc) for +instructions on how to build under Windows. + +Alternative Compilers +--------------------- + +Additionally, the following projects allow you to compile OCaml code to +targets traditionally associated with other languages: + +* [Js_of_ocaml](http://ocsigen.org/js_of_ocaml/) is a stable OCaml + to JavaScript compiler. + +User Manual +------------- + +The user manual for OCaml can be: + +- [Browsed online](https://ocaml.org/releases/5.3/manual/index.html) +- Downloaded as a single + [PDF](https://ocaml.org/releases/5.3/ocaml-5.3-refman.pdf) + or [plain + text](https://ocaml.org/releases/5.3/ocaml-5.3-refman.txt) + document +- Downloaded as a single + [TAR](https://ocaml.org/releases/5.3/ocaml-5.3-refman-html.tar.gz) + or + [ZIP](https://ocaml.org/releases/5.3/ocaml-5.3-refman-html.zip) + archive of HTML files +- Downloaded as a single + [tarball](https://ocaml.org/releases/5.3/ocaml-5.3-refman.info.tar.gz) + of Emacs info files + + +## Changes + +(Changes that can break existing programs are marked with a "*") + +### Restored backend: + +- [#12954](https://github.com/ocaml/ocaml/issues/12954): Restore the MSVC port + (David Allsopp, Antonin Décimo, Samuel Hym, and Miod Vallat, review by Nicolás + Ojeda Bär) + +- [#13093](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12309), [#13158](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11736), [#12664](https://github.com/ocaml/ocaml/issues/12664), [#13628](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12828), [#13283](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11891), [#12507](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11911), [#12923](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13364): Emit major slice counters in the runtime events. + (KC Sivaramakrishnan and Sadiq Jaffer, review by Gabriel Scherer) + +- [#13382](https://github.com/ocaml/ocaml/issues/13382): Add more documentation for Runtime_events types + (Sadiq Jaffer, review by Tim McGilchrist, Miod Vallat and KC Sivaramakrishnan) + +- [#13370](https://github.com/ocaml/ocaml/issues/13370): Fix a low-probability crash when calling Gc.counters. + (Demi Marie Obenour, review by Gabriel Scherer) + +- [#13272](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12789): Restore caml_unregister_frametable from OCaml 4 + (Frédéric Recoules, review by Gabriel Scherer) + +- [#13003](https://github.com/ocaml/ocaml/issues/13003): new, more consistent names for array-creation C functions + (Gabriel Scherer, review by Olivier Nicole) + +- [#13013](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12407), [#13226](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13086): Avoid spurious major GC slices. + (Damien Doligez, report by Stephen Dolan, review by Gabriel Scherer + and Stephen Dolan) + +- [#11779](https://github.com/ocaml/ocaml/issues/11779), [#13117](https://github.com/ocaml/ocaml/issues/13117): Improve logic for fiber stack alignment. + (Miod Vallat, report by Damien Doligez, review by Gabriel Scherer) + +- [#12839](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13163): Enable frame pointers on macOS x86_64 + (Tim McGilchrist, review by Sébastien Hinderer and Fabrice Buoro) + +- [#12951](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/10696): Introduce __has_attribute and __has_c_attributes in + to test the support of specific atributes 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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13239): Check whether the compiler supports the labels as values + extension to enable threaded code interpretation. + (Antonin Décimo, review by Miod Vallat) + +- [#13238](https://github.com/ocaml/ocaml/issues/13238): Enable software prefetching on x86 and x86_64 when building + with MSVC or clang-cl. + (Antonin Décimo, review by Miod Vallat) + +- [#13241](https://github.com/ocaml/ocaml/issues/13241), [#13261](https://github.com/ocaml/ocaml/issues/13261), [#13271](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13280): Check for support of compiler attributes. Allows using + compiler attributes with clang-cl. + (Antonin Décimo, review by Miod Vallat) + +- [#13243](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13402), [#13512](https://github.com/ocaml/ocaml/issues/13512), [#13549](https://github.com/ocaml/ocaml/issues/13549), [#13553](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13407): Add Runtime_events.EV_EMPTY_MINOR + (Thomas Leonard) + +- [#13522](https://github.com/ocaml/ocaml/issues/13522): Confirm runtime events ring is still active after callback. + (KC Sivaramakrishnan, review by Sadiq Jaffer and Miod Vallat) + +- [#13529](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/7241), [#12555](https://github.com/ocaml/ocaml/issues/12555), [#13076](https://github.com/ocaml/ocaml/issues/13076), [#13138](https://github.com/ocaml/ocaml/issues/13138), [#13338](https://github.com/ocaml/ocaml/issues/13338), [#13152](https://github.com/ocaml/ocaml/issues/13152), [#13153](https://github.com/ocaml/ocaml/issues/13153), [#13154](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13179): Fix evaluation of toplevel lets in classes containing + local opens + (Vincent Laviron, review by Hugo Heuzard, Nathanaëlle Courant + and Gabriel Scherer) + +- [#13543](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12884): Add `Queue.drop` + (Léo Andrès, review by Nicolás Ojeda Bär and Gabriel Scherer) + +- [#13168](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12133): Expose support for printing substrings in Format + (Florian Angeletti, review by Daniel Bünzli, Gabriel Scherer + and Nicolás Ojeda Bär) + +- [#12869](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13047): Add Sys.poll_actions to (only) run pending runtime actions. + (Nick Barnes, review by Gabriel Scherer, Guillaume Munch-Maccagnoni, and + Vincent Laviron) + +- [#13144](https://github.com/ocaml/ocaml/issues/13144): Dynarray.{equal, compare} + (Gabriel Scherer, + review by Jeremy Yallop, Daniel Bünzli and Olivier Nicole, + request by Olivier Nicole) + +- [#13171](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11996): release the dependency of dynlink on compilerlibs. + (Sébastien Hinderer and Stephen Dolan, review by Damien Doligez and + Hugo Heuzard) + +- [#13326](https://github.com/ocaml/ocaml/issues/13326): Implement Unix.O_APPEND on windows. + (Romain Beauxis, review by Miod Vallat, Gabriel Scherer and Antonin Décimo) + +### Tools: + +- [#11716](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12891): Improved styling for initial prompt + (Florian Angeletti, review by Gabriel Scherer) + +- [#13053](https://github.com/ocaml/ocaml/issues/13053): Improved display of builtin types such as `_ list` when aliased. + (Samuel Vivien, review by Florian Angeletti) + +### Manual and documentation: + +- [#13370](https://github.com/ocaml/ocaml/issues/13370): Document that that temporary variables holding GCd pointers must + not be live across a GC. + (Demi Marie Obenour) + +- [#12298](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12976): Manual: use webman//*.html and + webman//api/ for OCaml.org HTML manual generation + (Shakthi Kannan, review by Hannes Mehnert, and Florian Angeletti) + +- [#13045](https://github.com/ocaml/ocaml/issues/13045): Emphasize caution about behaviour of custom block finalizers. + (Nick Barnes) + +- [#13216](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13287): stdlib/sys.mli: Update documentation on Sys.opaque_identity + following [#9412](https://github.com/ocaml/ocaml/issues/9412). + (Matt Walker, review by Guillaume Munch-Maccagnoni and Vincent Laviron) + +- [#13295](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13440): Update documentation of `Gc.{control,get,set}` to reflect fields + not currently supported on OCaml 5. + (Jan Midtgaard, review by Gabriel Scherer) + +- [#13469](https://github.com/ocaml/ocaml/issues/13469), [#13474](https://github.com/ocaml/ocaml/issues/13474), [#13535](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12084), [#13669](https://github.com/ocaml/ocaml/issues/13669), [#13673](https://github.com/ocaml/ocaml/issues/13673): Check link order when creating archive and when using + ocamlopt. + (Hugo Heuzard, review by Stefan Muenzel and Sébastien Hinderer) + +- [#12980](https://github.com/ocaml/ocaml/issues/12980): Explain type mismatch involving first-class modules by including + the module level error message + (Florian Angeletti, review by Vincent Laviron) + +- [#12985](https://github.com/ocaml/ocaml/issues/12985), [#12988](https://github.com/ocaml/ocaml/issues/12988): Better error messages for partially applied functors. + (Florian Angeletti, report by Arthur Wendling, review by Gabriel Scherer) + +- [#13034](https://github.com/ocaml/ocaml/issues/13034), [#13260](https://github.com/ocaml/ocaml/issues/13260): Better error messages for mismatched function labels + (Florian Angeletti, report by Daniel Bünzli, review by Gabriel Scherer and + Samuel Vivien) + +- [#13051](https://github.com/ocaml/ocaml/issues/13051): Add a "Syntax error" to error messages for invalid package signatures. + (Samuel Vivien, review by Gabriel Scherer) + +- [#13099](https://github.com/ocaml/ocaml/issues/13099): Fix erroneous loading of cmis for some module type errors. + (Nick Roberts, review by Florian Angeletti) + +- [#13151](https://github.com/ocaml/ocaml/issues/13151), name conflicts explanation as a footnote + (Florian Angeletti, review by Gabriel Scherer) + +- [#13228](https://github.com/ocaml/ocaml/issues/13228): Re-export Cmt2annot.{iterator,binary_part} which had become hidden + since [#11288](https://github.com/ocaml/ocaml/issues/11288) and broke ocamlbrowser. + (David Allsopp, report by Jacques Garrigue, review by Sébastien Hinderer) + +- [#13251](https://github.com/ocaml/ocaml/issues/13251): Register printer for errors in Emitaux + (Vincent Laviron, review by Miod Vallat and Florian Angeletti) + +- [#13255](https://github.com/ocaml/ocaml/issues/13255): Re-enable warning 34 for unused locally abstract types + (Nick Roberts, review by Chris Casinghino and Florian Angeletti) + +- [#12182](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13471): add `-keywords ` 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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/11129), [#11148](https://github.com/ocaml/ocaml/issues/11148): enforce that ppxs do not produce `parsetree`s 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](https://github.com/ocaml/ocaml/issues/12534): document and refactor Matching.mk_failaction_pos + (Gabriel Scherer, review by Vincent Laviron and Nick Roberts) + +- [#13076](https://github.com/ocaml/ocaml/issues/13076): change the handling of Match_failure exits in the pattern-matching + compiler, to prepare for a complete fix for [#7241](https://github.com/ocaml/ocaml/issues/7241) + (Gabriel Scherer, review by Thomas Refis and Nick Roberts) + +- [#12896](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12932): Remove useless code in Typecore.type_label_exp (was a fix for [#4862](https://github.com/ocaml/ocaml/issues/4862)) + (Jacques Garrigue, review by Gabriel Scherer) + +- [#12943](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12968): Attach location to constants in the parsetree + (Jules Aguillon, review by Gabriel Scherer) + +- [#12959](https://github.com/ocaml/ocaml/issues/12959), [#13055](https://github.com/ocaml/ocaml/issues/13055): Avoid an internal error on recursive module type inconsistency + (Florian Angeletti, review by Jacques Garrigue and Gabriel Scherer) + +- [#13049](https://github.com/ocaml/ocaml/issues/13049): graphical debugging printer for types + (Florian Angeletti, review by Gabriel Scherer) + +- [#13074](https://github.com/ocaml/ocaml/issues/13074), [#13082](https://github.com/ocaml/ocaml/issues/13082), [#13084](https://github.com/ocaml/ocaml/issues/13084): refactoring in the pattern-matching compiler + (Gabriel Scherer, review by Thomas Refis, Vincent Laviron and Nick Roberts) + +- [#13067](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13162): Use quoted strings to clarify code being generated. + (Antonin Décimo, review by Miod Vallat and Gabriel Scherer) + +- [#13015](https://github.com/ocaml/ocaml/issues/13015): Emit floating-point literals in .rodata section on ELF arm64 + platforms (Linux, *BSD). + (Miod Vallat, review by Nicolás Ojeda Bär) + +- [#13169](https://github.com/ocaml/ocaml/issues/13169), [#13311](https://github.com/ocaml/ocaml/issues/13311): Introduce a document data type for compiler messages + rather than relying on `Format.formatter -> unit` closures. + (Florian Angeletti, review by Gabriel Scherer) + +- [#13193](https://github.com/ocaml/ocaml/issues/13193): Remove the unused env_init field from class blocks + (Vincent Laviron, review by Jacques Garrigue) + +- [#13257](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12992), [#13009](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12996): Only link with -lgcc_eh when available. + (Romain Beauxis, review by David Allsopp and Miod Vallat) + +* (*breaking change*) [#13200](https://github.com/ocaml/ocaml/issues/13200): Do not use CFLAGS for linking. + (Sébastien Hinderer, review by Gabriel Scherer, Antonin Décimo, + Miod Vallat and Samuel Hym) + +- [#13201](https://github.com/ocaml/ocaml/issues/13201), [#13244](https://github.com/ocaml/ocaml/issues/13244): Fix and speedup builds with TSan. + (Sébastien Hinderer, review by Miod Vallat, Gabriel Scherer and + Olivier Nicole) + +* (*breaking change*) [#12578](https://github.com/ocaml/ocaml/issues/12578), [#12589](https://github.com/ocaml/ocaml/issues/12589), [#13322](https://github.com/ocaml/ocaml/issues/13322), [#13519](https://github.com/ocaml/ocaml/issues/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) + +- [#13285](https://github.com/ocaml/ocaml/issues/13285): continue the merge of the sub-makefiles into the root + Makefile started with [#11243](https://github.com/ocaml/ocaml/issues/11243), [#11248](https://github.com/ocaml/ocaml/issues/11248), [#11268](https://github.com/ocaml/ocaml/issues/11268), [#11420](https://github.com/ocaml/ocaml/issues/11420), [#11675](https://github.com/ocaml/ocaml/issues/11675), + [#12198](https://github.com/ocaml/ocaml/issues/12198), [#12321](https://github.com/ocaml/ocaml/issues/12321), [#12586](https://github.com/ocaml/ocaml/issues/12586), [#12616](https://github.com/ocaml/ocaml/issues/12616), [#12706](https://github.com/ocaml/ocaml/issues/12706) and [#13048](https://github.com/ocaml/ocaml/issues/13048). + (Sébastien Hinderer, review by David Allsopp and Florian Angeletti) + +### Bug fixes: + +- [#12854](https://github.com/ocaml/ocaml/issues/12854): Add a test in the regression suite that flags the bug [#12825](https://github.com/ocaml/ocaml/issues/12825). + (Luc Maranget) + +- [#12888](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12910), [#12920](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/12994): Remove un-used and unsafe caml_drop_continuation + (Tim McGilchrist, reviewed by Gabriel Scherer and Miod Vallat) + +- [#12963](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13103): FreeBSD/amd64: properly annotate .o files with non-executable stack + notes (Konstantin Belousov, review by Nicolás Ojeda Bär) + +- [#13150](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13185), [#13192](https://github.com/ocaml/ocaml/issues/13192): Reject type-level module aliases on functor parameter + inside signatures. + (Jacques Garrigue, report by Richard Eisenberg, review by Florian Angeletti) + +- [#13170](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13203): Do not issue warning 53 if the compiler is stopping before attributes + have been accurately marked. + (Chris Casinghino, review by Florian Angeletti) + +- [#13207](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13209): Fix configure test that checks whether `ar` supports `@FILE` + arguments. + (Nicolás Ojeda Bär, report by Boris D.) + +- [#13221](https://github.com/ocaml/ocaml/issues/13221): Compute more accurate instruction sizes for branch relocation on + POWER. + (Miod Vallat, review by Gabriel Scherer) + +- [#13252](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13234), [#13267](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13140): POWER back-end: fix issue with call to `caml_call_realloc_stack` + from a DLL + (Xavier Leroy, review by Miod Vallat) + +- [#13263](https://github.com/ocaml/ocaml/issues/13263), [#13560](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13388), [#13540](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13501): Regression on mutually recursive types caused by [#12180](https://github.com/ocaml/ocaml/issues/12180). + Resuscitate Typedecl.update_type. + (Jacques Garrigue and Takafumi Saikawa, review by Florian Angeletti, Richard + Eisenberg and Gabriel Scherer) + +- [#13502](https://github.com/ocaml/ocaml/issues/13502): Fix misindexing related to `Gc.finalise_last` that could prevent + finalisers from being run. + (Nick Roberts, review by Mark Shinwell) + +- [#13495](https://github.com/ocaml/ocaml/issues/13495), [#13514](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13391), [#13551](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13541), [#13591](https://github.com/ocaml/ocaml/issues/13591): Fix headers for C++ inclusion. + (Antonin Décimo, review by Nick Barnes, report by Kate Deplaix) + +- [#13579](https://github.com/ocaml/ocaml/issues/13579), [#13583](https://github.com/ocaml/ocaml/issues/13583): Unsoundness involving non-injective types + gadts + (Jacques Garrigue, report by @v-gb, + review by Richard Eisenberg and Florian Angeletti) + +- [#13598](https://github.com/ocaml/ocaml/issues/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](https://github.com/ocaml/ocaml/issues/13603), [#13604](https://github.com/ocaml/ocaml/issues/13604): fix source printing in the presence of the escaped raw + identifier `\#mod`. + (Florian Angeletti, report by Chris Casinghino, review by Gabriel Scherer)