OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of May 21 to 28, 2019.

Table of Contents

OCaml 4.08.0+rc1

Damien Doligez announced

The release of OCaml version 4.08.0 is imminent. We have created a release candidate that you can test.

The source code is available at these addresses:

https://github.com/ocaml/ocaml/archive/4.08.0+rc1.tar.gz
https://caml.inria.fr/pub/distrib/ocaml-4.08/4.08.0+rc1.tar.gz

The compiler can also be installed as an OPAM switch with one of the following commands.

opam switch create ocaml-variants.4.08.0+rc1 –repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

or

opam switch create ocaml-variants.4.08.0+rc1+<VARIANT> –repositories=default,beta=git+https://github.com/ocaml/ocaml-beta-repository.git

where you replace <VARIANT> with one of these:

  • afl
  • default_unsafe_string
  • flambda
  • fp
  • fp+flambda

We want to know about all bugs. Please report them here: https://github.com/ocaml/ocaml/issues

Happy hacking,

Damien Doligez for the OCaml team.

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

Language features:

  • #1947: Introduce binding operators (let*, let+, and* etc.) (Leo White, review by Thomas Refis)
  • #1892: Allow shadowing of items coming from an include (Thomas Refis, review by Gabriel Radanne)
  • #2122: Introduce local substitutions in signatures: "type t := type_expr" and "module M := Extended(Module).Path" (Thomas Refis, with help and review from Leo White, and Alain Frisch)
  • #1804: New notion of "alerts" that generalizes the deprecated warning [@@ocaml.alert deprecated "Please use bar instead!"] [@@ocaml.alert unsafe "Please use safe_foo instead!"] (Alain Frisch, review by Leo White and Damien Doligez)
  • #6422, #7083, #305, #1568: Allow exception under or-patterns (Thomas Refis, with help and review from Alain Frisch, Gabriel Scherer, Jeremy Yallop, Leo White and Luc Maranget)
  • #1705: Allow @@attributes on exception declarations. (Hugo Heuzard, review by Gabriel Radanne and Thomas Refis)
  • #1506, #2147, #2166, #2167: Extended open to arbitrary module expression in structures and to applicative paths in signatures (Runhang Li, review by Alain Frisch, Florian Angeletti, Jeremy Yallop, Leo White and Thomas Refis)
  • * #2106: .~ is now a reserved keyword, and is no longer available for use in extended indexing operators (Jeremy Yallop, review by Gabriel Scherer, Florian Angeletti, and Damien Doligez)
  • * #7841, #2041, #2235: allow modules from include directories to shadow other ones, even in the toplevel; for a example, including a directory that defines its own Result module will shadow the stdlib's. (Jérémie Dimino, review by Alain Frisch and David Allsopp)

Type system:

  • #2110: Partial support for GADTs inside or-patterns; The type equalities introduced by the GADT constructor are only available inside the or-pattern; they cannot be used in the right-hand-side of the clause, when both sides of the or-pattern agree on it. (Thomas Refis and Leo White, review by Jacques Garrigue)
  • #1826: allow expanding a type to a private abbreviation instead of abstracting when removing references to an identifier. (Thomas Refis and Leo White, review by Jacques Garrigue)
  • #1942, #2244: simplification of the static check for recursive definitions (Alban Reynaud and Gabriel Scherer, review by Jeremy Yallop, Armaël Guéneau and Damien Doligez)

Standard library:

  • #2128: Add Fun module: id, const, flip, negate, protect (protect is a "try_finally" combinator) https://caml.inria.fr/pub/docs/manual-ocaml/libref/Fun.html (Many fine eyes)
  • #2010: Add Bool module https://caml.inria.fr/pub/docs/manual-ocaml/libref/Bool.html (Many fine eyes)
  • #2011: Add Int module https://caml.inria.fr/pub/docs/manual-ocaml/libref/Int.html (Many fine eyes)
  • #1940: Add Option module and Format.pp_print_option none, some, value, get, bind, join, map, fold, iter, etc. https://caml.inria.fr/pub/docs/manual-ocaml/libref/Option.html (Many fine eyes)
  • #1956: Add Result module and Format.pp_print_result ok, error, value, get_ok, bind, join, map, map_error, etc. https://caml.inria.fr/pub/docs/manual-ocaml/libref/Result.html (Many fine eyes)
  • #1855, #2118: Add Fun.protect ~finally for enforcing local invariants whether a function raises or not, similar to unwind-protect in Lisp and FINALLY in Modula-2. It is careful about preserving backtraces and treating exceptions in finally as errors. (Marcello Seri and Guillaume Munch-Maccagnoni, review by Daniel Bünzli, Gabriel Scherer, François Bobot, Nicolás Ojeda Bär, Xavier Clerc, Boris Yakobowski, Damien Doligez, and Xavier Leroy)
  • * #1605: Deprecate Stdlib.Pervasives. Following #1010, Pervasives is no longer needed and Stdlib should be used instead. (Jérémie Dimino, review by Nicolás Ojeda Bär)
  • #2185: Add List.filter_map (Thomas Refis, review by Alain Frisch and Gabriel Scherer)
  • #1957: Add Stack.{top_opt,pop_opt} and Queue.{peek_opt,take_opt}. (Vladimir Keleshev, review by Nicolás Ojeda Bär and Gabriel Scherer)
  • #1182: Add new Printf formats %#d %#Ld %#ld %#nd (idem for %i and %u) for alternative integer formatting – inserts '_' between blocks of digits. (ygrek, review by Gabriel Scherer)
  • #1959: Add Format.dprintf, a printing function which outputs a closure usable with %t. (Gabriel Radanne, request by Armaël Guéneau, review by Florian Angeletti and Gabriel Scherer)
  • #1986, #6450: Add Set.disjoint (Nicolás Ojeda Bär, review by Gabriel Scherer)
  • #7812, #2125: Add Filename.chop_suffix_opt (Alain Frisch, review by Nicolás Ojeda Bär, suggestion by whitequark)
  • #1864: Extend Bytes and Buffer with functions to read/write binary representations of numbers (Alain Frisch and Daniel Bünzli)
  • #1458: Add unsigned operations unsigned_div, unsigned_rem, unsigned_compare and unsigned_to_int to modules Int32, Int64, Nativeint. (Nicolás Ojeda Bär, review by Daniel Bünzli, Alain Frisch and Max Mouratov)
  • #2002: Add Format.pp_print_custom_break, a new more general kind of break hint that can emit non-whitespace characters. (Vladimir Keleshev and Pierre Weis, review by Josh Berdine, Gabriel Radanne)
  • #1966: Add Format semantic tags using extensible sum types. (Gabriel Radanne, review by Nicolás Ojeda Bär)
  • #1794: Add constants zero, one, minus_one and functions succ, pred, is_finite, is_infinite, is_nan, is_integer, trunc, round, next_after, sign_bit, min, max, min_max, min_num, max_num, min_max_num to module Float. (Christophe Troestler, review by Alain Frish, Xavier Clerc and Daniel Bünzli)
  • #1354, #2177: Add fma support to Float module. (Laurent Thévenoux, review by Alain Frisch, Jacques-Henri Jourdan, Xavier Leroy)
  • #5072, #6655, #1876: add aliases in Stdlib for built-in types and exceptions. (Jeremy Yallop, reports by Pierre Letouzey and David Sheets, review by Valentin Gatien-Baron, Gabriel Scherer and Alain Frisch)
  • #1731: Format, use raise_notrace to preserve backtraces. (Frédéric Bour, report by Jules Villard, review by Gabriel Scherer)
  • #6701, #1185, #1803: make float_of_string and string_of_float locale-independent. (ygrek, review by Xavier Leroy and Damien Doligez)
  • #7795, #1782: Fix off-by-one error in Weak.create. (KC Sivaramakrishnan, review by Gabriel Scherer and François Bobot)
  • #7235: Format, flush err_formatter at exit. (Pierre Weis, request by Jun Furuse)
  • #1857, #7812: Remove Sort module, deprecated since 2000 and emitting a deprecation warning since 4.02. (whitequark)
  • #1923: Arg module sometimes misbehaved instead of rejecting invalid -keyword=arg inputs (Valentin Gatien-Baron, review by Gabriel Scherer)
  • #1959: Small simplification and optimization to Format.ifprintf (Gabriel Radanne, review by Gabriel Scherer)
  • #2119: clarify the documentation of Set.diff (Gabriel Scherer, suggestion by John Skaller)
  • #2145: Deprecate the mutability of Gc.control record fields (Damien Doligez, review by Alain Frisch)
  • #2159, #7874: annotate {String,Bytes}.equal as being [@@noalloc]. (Pierre-Marie Pédrot, review by Nicolás Ojeda Bär)
  • #1936: Add module Float.Array (Damien Doligez, review by Xavier Clerc and Alain Frisch)
  • #2183: Fix segfault in Array.create_float with -no-flat-float-array (Damien Doligez, review by Gabriel Scherer and Jeremy Yallop)
  • #1525: Make function set_max_indent respect documentation (Pierre Weis, Richard Bonichon, review by Florian Angeletti)
  • #2202: Correct Hashtbl.MakeSeeded.{add_seq,replace_seq,of_seq} to use functor hash function instead of default hash function. Hashtbl.Make.of_seq shouldn't create randomized hash tables. (David Allsopp, review by Alain Frisch)

Other libraries:

  • #2533, #1839, #1949: added Unix.fsync (Francois Berenger, Nicolás Ojeda Bär, review by Daniel Bünzli, David Allsopp and ygrek)
  • #1792, #7794: Add Unix.open_process_args{,_in,_out,_full} similar to Unix.open_process{,_in,_out,_full}, but passing an explicit argv array. (Nicolás Ojeda Bär, review by Jérémie Dimino, request by Volker Diels-Grabsch)
  • #1999: Add Unix.process{,_in,_out,_full}_pid to retrieve opened process's pid. (Romain Beauxis, review by Nicolás Ojeda Bär)
  • #2222: Set default status in waitpid when pid is zero. Otherwise, status value is undefined. (Romain Beauxis and Xavier Leroy, review by Stephen Dolan)
  • * #2104, #2211, #4127, #7709: Fix Thread.sigmask. When system threads are loaded, Unix.sigprocmask is now an alias for Thread.sigmask. This changes the behavior at least on MacOS, where Unix.sigprocmask used to change the masks of all threads. (Jacques-Henri Jourdan, review by Jérémie Dimino)
  • #1061: Add ?follow parameter to Unix.link. This allows hardlinking symlinks. (Christopher Zimmermann, review by Xavier Leroy, Damien Doligez, David Allsopp, David Sheets)
  • #2038: Deprecate vm threads. OCaml supported both "native threads", based on pthreads, and its own green-threads implementation, "vm threads". We are not aware of any recent usage of "vm threads", and removing them simplifies further maintenance. (Jérémie Dimino)
  • * #4208, #4229, #4839, #6462, #6957, #6950, #1063, #2176, #2297: Make (nat)dynlink sound by correctly failing when dynlinked module names clash with other modules or interfaces. (Mark Shinwell, Leo White, Nicolás Ojeda Bär, Pierre Chambart)
  • #2263: Delete the deprecated Bigarray.*.map_file functions in favour of *_of_genarray (Unix.map_file ...) functions instead. The Unix.map_file function was introduced in OCaml 4.06.0 onwards. (Jérémie Dimino, reviewed by David Allsopp and Anil Madhavapeddy)

Compiler user-interface and warnings:

  • #2096: Add source highlighting for errors & warnings in batch mode (Armaël Guéneau, review by Gabriel Scherer and Jérémie Dimino)
  • #2133: [@ocaml.warn_on_literal_pattern]: now warn on literal patterns found anywhere in a constructor's arguments. (Jeremy Yallop, review by Gabriel Scherer)
  • #1720: Improve error reporting for missing 'rec' in let-bindings. (Arthur Charguéraud and Armaël Guéneau, with help and advice from Gabriel Scherer, Frédéric Bour, Xavier Clerc and Leo White)
  • #7116, #1430: new -config-var option to get the value of a single configuration variable in scripts. (Gabriel Scherer, review by Sébastien Hinderer and David Allsopp, request by Adrien Nader)
  • #1733,1993,1998,2058,2094,2140: Typing error message improvements

    • #1733, change the perspective of the unexpected existential error message.
    • #1993, expanded error messages for universal quantification failure
    • #1998, more context for unbound type parameter error
    • #2058, full explanation for unsafe cycles in recursive module definitions (suggestion by Ivan Gotovchits)
    • #2094, rewording for "constructor has no type" error
    • #7565, #2140, more context for universal variable escape in method type

    (Florian Angeletti, reviews by Jacques Garrique, Armaël Guéneau, Gabriel Radanne, Gabriel Scherer and Jeremy Yallop)

  • #1913: new flag -dump-into-file to print debug output like -dlambda into a file named after the file being built, instead of on stderr. (Valentin Gatien-Baron, review by Thomas Refis)
  • #1921: in the compilation context passed to ppx extensions, add more configuration options related to type-checking: -rectypes, -principal, -alias-deps, -unboxed-types, -unsafe-string (Gabriel Scherer, review by Gabriel Radanne, Xavier Clerc and Frédéric Bour)
  • #1976: Better error messages for extension constructor type mismatches (Thomas Refis, review by Gabriel Scherer)
  • #1841, #7808: the environment variable OCAMLTOP_INCLUDE_PATH can now specify a list of additional include directories for the ocaml toplevel. (Nicolás Ojeda Bär, request by Daniel Bünzli, review by Daniel Bünzli and Damien Doligez)
  • #6638, #1110: introduced a dedicated warning to report unused "open!" statements (Alain Frisch, report by dwang, review by and design from Leo White)
  • #1974: Trigger warning 5 in "let _ = e" and "ignore e" if e is of function type and syntactically an application. (For the case of "ignore e" the warning already existed, but used to be triggered even when e was not an application.) (Nicolás Ojeda Bär, review by Alain Frisch and Jacques Garrigue)
  • #7408, #7846, #2015: Check arity of primitives. (Hugo Heuzard, review by Nicolás Ojeda Bär)
  • #2091: Add a warning triggered by type declarations "type t = ()" (Armaël Guéneau, report by linse, review by Florian Angeletti and Gabriel Scherer)
  • #2004: Use common standard library path lib/ocaml for Windows, for consistency with OSX & Linux. Previously was located at lib. (Bryan Phelps, Jordan Walke, review by David Allsopp)
  • #6416, #1120: unique printed names for identifiers (Florian Angeletti, review by Jacques Garrigue)
  • #1691: add shared_libraries to ocamlc -config exporting SUPPORTS_SHARED_LIBRARIES from Makefile.config. (David Allsopp, review by Gabriel Scherer and Mark Shinwell)
  • #6913, #1786: new -match-context-rows option to control the degree of optimization in the pattern matching compiler. (Dwight Guth, review by Gabriel Scherer and Luc Maranget)
  • #1822: keep attributes attached to pattern variables from being discarded. (Nicolás Ojeda Bär, review by Thomas Refis)
  • #1845: new -dcamlprimc option to keep the generated C file containing the information about primitives; pass -fdebug-prefix-map to the C compiler when supported, for reproducible builds (Xavier Clerc, review by Jérémie Dimino)
  • #1856, #1869: use BUILD_PATH_PREFIX_MAP when compiling primitives in order to make builds reproducible if code contains uses of __FILE__ or __LOC__ (Xavier Clerc, review by Gabriel Scherer and Sébastien Hinderer)
  • #1906: the -unsafe option does not apply to marshalled ASTs passed to the compiler directly or by a -pp preprocessor; add a proper warning (64) instead of a simple stderr message (Valentin Gatien-Baron)
  • #1925: Print error locations more consistently between batch mode, toplevel and expect tests (Armaël Guéneau, review by Thomas Refis, Gabriel Scherer and François Bobot)
  • #1930: pass the elements from BUILD_PATH_PREFIX_MAP to the assembler (Xavier Clerc, review by Gabriel Scherer, Sébastien Hinderer, and Xavier Leroy)
  • #1945, #2032: new "-stop-after [parsing|typing]" option to stop compilation after the parsing or typing pass (Gabriel Scherer, review by Jérémie Dimino)
  • #1953: Add locations to attributes in the parsetree. (Hugo Heuzard, review by Gabriel Radanne)
  • #1954: Add locations to toplevel directives. (Hugo Heuzard, review by Gabriel Radanne)
  • * #1979: Remove support for TERM=norepeat when displaying errors (Armaël Guéneau, review by Gabriel Scherer and Florian Angeletti)
  • #1960: The parser keeps previous location when relocating ast node. (Hugo Heuzard, review by Jérémie Dimino)
  • #7864, #2109: remove duplicates from spelling suggestions. (Nicolás Ojeda Bär, review by Armaël Guéneau)

Manual and documentation:

  • #7548: printf example in the tutorial part of the manual (Kostikova Oxana, rewiew by Gabriel Scherer, Florian Angeletti, Marcello Seri and Armaël Guéneau)
  • #7546, #2020: preambles and introduction for compiler-libs. (Florian Angeletti, review by Daniel Bünzli, Perry E. Metzger and Gabriel Scherer)
  • #7547, #2273: Tutorial on Lazy expressions and patterns in OCaml Manual (Ulugbek Abdullaev, review by Florian Angeletti and Gabriel Scherer)
  • #7720, #1596, precise the documentation of the maximum indentation limit in Format. (Florian Angeletti, review by Richard Bonichon and Pierre Weis)
  • #7825: html manual split compilerlibs from stdlib in the html index of modules (Florian Angeletti, review by Perry E. Metzger and Gabriel Scherer)
  • #1209, #2008: in the Extension section, use the caml_example environment (uses the compiler to check the example code). This change was made possible by a lot of tooling work from Florian Angeletti: #1702, #1765, #1863, and Gabriel Scherer's #1903. (Gabriel Scherer, review by Florian Angeletti)
  • #1788, 1831, 2007, 2198, 2232, move language extensions to the core chapters:

    • #1788: quoted string description
    • #1831: local exceptions and exception cases
    • #2007: 32-bit, 64-bit and native integer literals
    • #2198: lazy patterns
    • #2232: short object copy notation

    (Florian Angeletti, review by Xavier Clerc, Perry E. Metzger, Gabriel Scherer and Jeremy Yallop)

  • #1863: caml-tex2, move to compiler-libs (Florian Angeletti, review by Sébastien Hinderer and Gabriel Scherer)
  • #2105: Change verbatim to caml_example in documentation (Maxime Flin, review by Florian Angeletti)
  • #2114: ocamldoc, improved manpages for documentation inside modules (Florian Angeletti, review by Gabriel Scherer)
  • #2117: stdlib documentation, duplicate the operator precedence table from the manual inside a separate "OCaml_operators" module. (Florian Angeletti, review by Daniel Bünzli, Perry E. Metzger and Gabriel Scherer)
  • #2187: document "exception A | pat" patterns (Florian Angeletti, review by Perry E. Metzger and Jeremy Yallop)
  • #8508: refresh \moduleref macro (Florian Angeletti, review by Gabriel Scherer)

Code generation and optimizations:

  • #7725, #1754: improve AFL instrumentation for objects and lazy values. (Stephen Dolan)
  • #1631: AMD64 code generator: emit shorter instruction sequences for the sign-extension operations. (LemonBoy, review by Alain Frisch and Xavier Leroy)
  • #7246, #2146: make a few int64 primitives use [@@unboxed] stubs on 32bits (Jérémie Dimino)
  • #1917: comballoc: ensure object allocation order is preserved (Stephen Dolan)
  • #6242, #2143, #8558, #8559: Optimize some local functions. Local functions that do not escape and whose calls all have the same continuation are lowered into a static-catch handler. (Alain Frisch, review by Gabriel Scherer)
  • #2082: New options [-insn-sched] and [-no-insn-sched] to control instruction scheduling. (Mark Shinwell, review by Damien Doligez)
  • #2239: Fix match miscompilation with flambda (Leo White, review by Alain Frisch)

Runtime system:

  • #7198, #7750, #1738: add a function (caml_alloc_custom_mem) and three GC parameters to give the user better control of the out-of-heap memory retained by custom values; use the function to allocate bigarrays and I/O channels. (Damien Doligez, review by Alain Frisch)
  • #1793: add the -m and -M command-line options to ocamlrun. Option -m prints the magic number of the bytecode executable passed as argument, -M prints the magic number expected by ocamlrun. (Sébastien Hinderer, review by Xavier Clerc and Damien Doligez)
  • #1867: Remove the C plugins mechanism. (Xavier Leroy, review by David Allsopp, Damien Doligez, Sébastien Hinderer)
  • #8627: Require SSE2 for 32-bit mingw port to generate correct code for caml_round with GCC 7.4. (David Allsopp, review by Xavier Leroy)
  • #7676, #2144: Remove old GC heuristic (Damien Doligez, report and review by Alain Frisch)
  • #1723: Remove internal Meta.static_{alloc,free} primitives. (Stephen Dolan, review by Gabriel Scherer)
  • #1895: Printexc.get_callstack would return only one frame in native code in threads other then the initial one (Valentin Gatien-Baron, review by Xavier Leroy)
  • #1900, #7814: avoid exporting non-prefixed identifiers in the debug and instrumented runtimes. (Damien Doligez, report by Gabriel Scherer)
  • #2079: Avoid page table lookup in Pervasives.compare with no-naked-pointers (Sam Goldman, review by Gabriel Scherer, David Allsopp, Stephen Dolan)
  • #7829, #8585: Fix pointer comparisons in freelist.c (for 32-bit platforms) (David Allsopp and Damien Doligez)
  • #8567, #8569: on ARM64, use 32-bit loads to access caml_backtrace_active (Xavier Leroy, review by Mark Shinwell and Greta Yorsh)
  • #8568: Fix a memory leak in mmapped bigarrays (Damien Doligez, review by Xavier Leroy and Jérémie Dimino)

Tools

  • #2182: Split Emacs caml-mode as an independent project. (Christophe Troestler, review by Gabriel Scherer)
  • #1865: support dark themes in Emacs, and clean up usage of deprecated Emacs APIs (Wilfred Hughes, review by Clément Pit-Claudel)
  • #1590: ocamllex-generated lexers can be instructed not to update their lex_curr_p/lex_start_p fields, resulting in a significant performance gain when those fields are not required. (Alain Frisch, review by Jérémie Dimino)
  • #7843, #2013: ocamldoc, better handling of {{!label}text} in the latex backend. (Florian Angeletti, review by Nicolás Ojeda Bär and Gabriel Scherer)
  • #7844, #2040: Emacs, use built-in detection of comments, fixes an imenu crash. (Wilfred Hughes, review by Christophe Troestler)
  • #7850: Emacs, use symbol boundaries in regular expressions, fixes an imenu crash. (Wilfred Hughes, review by Christophe Troestler)
  • #1711: the new 'open' flag in OCAMLRUNPARAM takes a comma-separated list of modules to open as if they had been passed via the command line -open flag. (Nicolás Ojeda Bär, review by Mark Shinwell)
  • #2000: ocamdoc, extended support for "include module type of …" (Florian Angeletti, review by Jérémie Dimino)
  • #2045: ocamlmklib now supports options -args and -args0 to provide extra command-line arguments in a file. (Nicolás Ojeda Bär, review by Gabriel Scherer and Daniel Bünzli)
  • #2189: change ocamldep Makefile-output to print each dependency on a new line, for more readable diffs of versioned dependencies. (Gabriel Scherer, review by Nicolás Ojeda Bär)
  • #2223: ocamltest: fix the "bsd" and "not-bsd" built-in actions to recognize all BSD variants (Damien Doligez, review by Sébastien Hinderer and David Allsopp)

Compiler distribution build system:

  • #1776: add -no-install-bytecode-programs and related configure options to control (non-)installation of ".byte" executables. (Mark Shinwell, review by Sébastien Hinderer and Gabriel Scherer)
  • #1777: add -no-install-source-artifacts and related configure options to control installation of .cmt, .cmti, .mli and .ml files. (Mark Shinwell, review by Nicolás Ojeda Bär and Sébastien Hinderer)
  • #1781: cleanup of the manual's build process. (steinuil, review by Marcello Seri, Gabriel Scherer and Florian Angeletti)
  • #1797: remove the deprecated Makefile.nt files. (Sébastien Hinderer, review by Nicolas Ojeda Bar)
  • #1805: fix the bootstrap procedure and its documentation. (Sébastien Hinderer, Xavier Leroy and Damien Doligez; review by Gabriel Scherer)
  • #1840: build system enhancements. (Sébastien Hinderer, review by David Allsopp, Xavier Leroy and Damien Doligez)
  • #1852: merge runtime directories (Sébastien Hinderer, review by Xavier Leroy and Damien Doligez)
  • #1854: remove the no longer defined BYTECCCOMPOPTS build variable. (Sébastien Hinderer, review by Damien Doligez)
  • #2024: stop supporting obsolete platforms: Rhapsody (old beta version of MacOS X), BeOS, alpha*-​*​-linux*​, mips-​*​-irix6​​*​, alpha​*​-​*​-unicos, powerpc-​*​-aix, ​*​-​*​-solaris2​*​, mips​*​-​*​-irix[56]​*​, i[3456]86-​*​-darwin[89].​*​, i[3456]86-​*​-solaris​*​, ​*​-​*​-sunos​*​ ​*​-​*​-unicos. (Sébastien Hinderer, review by Xavier Leroy, Damien Doligez, Gabriel Scherer and Armaël Guéneau)
  • #2053: allow unix, vmthreads and str not to be built. (David Allsopp, review by Sébastien Hinderer)
  • * #2059: stop defining OCAML_STDLIB_DIR in s.h. (Sébastien Hinderer, review by David Allsopp and Damien Doligez)
  • * #2066: remove the standard_runtime configuration variable. (Sébastien Hinderer, review by Xavier Leroy, Stephen Dolan and Damien Doligez)
  • * #2139: use autoconf to generate the compiler's configuration script (Sébastien Hinderer, review by Damien Doligez and David Allsopp)
  • #2148: fix a parallel build bug involving CamlinternalLazy. (Stephen Dolan, review by Gabriel Scherer and Nicolas Ojeda Bar)
  • #2264, #7904: the configure script now sets the Unicode handling mode under Windows according to the value of the variable WINDOWS_UNICODE_MODE. If WINDOWS_UNICODE_MODE is "ansi" then it is assumed to be the current code page encoding. If WINDOWS_UNICODE_MODE is "compatible" or empty or not set at all, then encoding is UTF-8 with code page fallback. (Nicolás Ojeda Bär, review by Sébastien Hinderer and David Allsopp)
  • #2266: ensure Cygwin ports configure with EXE=.exe, or the compiler is unable to find the camlheader files (subtle regression of #2139/2041) (David Allsopp, report and review by Sébastien Hinderer)
  • #7919, #2311: Fix assembler detection in configure (Sébastien Hinderer, review by David Allsopp)
  • #2295: Restore support for bytecode target XLC/AIX/Power (Konstantin Romanov, review by Sébastien Hinderer and David Allsopp)
  • #8528: get rid of the direct call to the C preprocessor in the testsuite (Sébastien Hinderer, review by David Allsopp)
  • #7938, #8532: Fix alignment detection for ints on 32-bits platforms (Sébastien Hinderer, review by Xavier Leroy)
  • * #8533: Remove some unused configure tests (Stephen Dolan, review by David Allsopp and Sébastien Hinderer)
  • #2207, #8604: Add opam files to allow pinning (Leo White, Greta Yorsh, review by Gabriel Radanne)
  • #8616: configure: use variables rather than arguments for a few options (Sébastien Hinderer, review by David Allsopp, Gabriel Scherer and Damien Doligez)
  • #8632: Correctly propagate flags for –with-pic in configure. (David Allsopp, review by Sébastien Hinderer and Damien Doligez)
  • #8673: restore SpaceTime and libunwind support in configure script (Sébastien Hinderer, review by Damien Doligez)

Internal/compiler-libs changes:

  • #7918, #1703, #1944, #2213, #2257: Add the module Compile_common, which factorizes the common part in Compile and Optcompile. This also makes the pipeline more modular. (Gabriel Radanne, help from Gabriel Scherer and Valentin Gatien-Baron, review by Mark Shinwell and Gabriel Radanne, regression spotted by Clément Franchini)
  • #292: use Menhir as the parser generator for the OCaml parser. Satellite GPRs: #1844, #1846, #1853, #1850, #1934, #2151, #2174 (Gabriel Scherer, Nicolás Ojeda Bär, Frédéric Bour, Thomas Refis and François Pottier, review by Nicolás Ojeda Bär, Leo White and David Allsopp)
  • #374: use Misc.try_finally for resource cleanup in the compiler codebase. This should fix the problem of catch-and-reraise try .. with blocks destroying backtrace information – in the compiler. (François Bobot, help from Gabriel Scherer and Nicolás Ojeda Bär, review by Gabriel Scherer)
  • #1148, #1287, #1288, #1874: significant improvements of the tools/check-typo script used over the files of the whole repository; contributors are now expected to check that check-typo passes on their pull requests; see CONTRIBUTING.md for more details. (David Allsopp, review by Damien Doligez and Sébastien Hinderer)
  • #1610, #2252: Remove positions from paths (Leo White, review by Frédéric Bour and Thomas Refis)
  • #1745: do not generalize the type of every sub-pattern, only of variables. (preliminary work for GADTs in or-patterns) (Thomas Refis, review by Leo White)
  • #1909: unsharing pattern types (preliminary work for GADTs in or-patterns) (Thomas Refis, with help from Leo White, review by Jacques Garrigue)
  • #1748: do not error when instantiating polymorphic fields in patterns. (Thomas Refis, review by Gabriel Scherer)
  • #2317: type_let: be more careful generalizing parts of the pattern (Thomas Refis and Leo White, review by Jacques Garrigue)
  • #1746: remove unreachable error variant: Make_seltype_nongen. (Florian Angeletti, review by Gabriel Radanne)
  • #1747: type_cases: always propagate (preliminary work for GADTs in or-patterns) (Thomas Refis, review by Jacques Garrigue)
  • #1811: shadow the polymorphic comparison in the middle-end (Xavier Clerc, review by Pierre Chambart)
  • #1833: allow non-val payloads in CMM Ccatch handlers (Simon Fowler, review by Xavier Clerc)
  • #1866: document the release process (Damien Doligez and Gabriel Scherer, review by Sébastien Hinderer, Perry E. Metzger, Xavier Leroy and David Allsopp)
  • #1886: move the Location.absname reference to Clflags.absname (Armaël Guéneau, review by Jérémie Dimino)
  • #1894: generalize highlight_dumb in location.ml to handle highlighting several locations (Armaël Guéneau, review by Gabriel Scherer)
  • #1903: parsetree, add locations to all nodes with attributes (Gabriel Scherer, review by Thomas Refis)
  • #1905: add check-typo-since to check the files changed since a given git reference (Gabriel Scherer, review by David Allsopp)
  • #1910: improve the check-typo use of .gitattributes (Gabriel Scherer, review by David Allsopp and Damien Doligez)
  • #1938: always check ast invariants after preprocessing (Florian Angeletti, review by Alain Frisch and Gabriel Scherer)
  • #1941: refactor the command line parsing of ocamlcp and ocamloptp (Valentin Gatien-Baron, review by Florian Angeletti)
  • #1948: Refactor Stdlib.Format. Notably, use Stdlib.Stack and Stdlib.Queue, and avoid exceptions for control flow. (Vladimir Keleshev, review by Nicolás Ojeda Bär and Gabriel Scherer)
  • * #1952: refactor the code responsible for displaying errors and warnings Location.report_error is removed, use Location.print_report instead (Armaël Guéneau, review by Thomas Refis)
  • #7835, #1980, #8548, #8586: separate scope from stamp in idents and explicitly rescope idents when substituting signatures. (Thomas Refis, review by Jacques Garrigue and Leo White)
  • #1996: expose Pprintast.longident to help compiler-libs users print Longident.t values. (Gabriel Scherer, review by Florian Angeletti and Thomas Refis)
  • #2030: makefile targets to build AST files of sources for parser testing. See parsing/HACKING.adoc. (Gabriel Scherer, review by Nicolás Ojeda Bär)
  • * #2041: add a cache for looking up files in the load path (Jérémie Dimino, review by Alain Frisch and David Allsopp)
  • #2047, #2269: a new type for unification traces (Florian Angeletti, report by Leo White (#2269), review by Thomas Refis and Gabriel Scherer)
  • #2055: Add [Linearize.Lprologue]. (Mark Shinwell, review by Pierre Chambart)
  • #2056: Use [Backend_var] rather than [Ident] from [Clambda] onwards; use [Backend_var.With_provenance] for variables in binding position. (Mark Shinwell, review by Pierre Chambart)
  • #2060: "Phantom let" support for the Clambda language. (Mark Shinwell, review by Vincent Laviron)
  • #2065: Add [Proc.destroyed_at_reloadretaddr]. (Mark Shinwell, review by Damien Doligez)
  • #2070: "Phantom let" support for the Cmm language. (Mark Shinwell, review by Vincent Laviron)
  • #2072: Always associate a scope to a type (Thomas Refis, review by Jacques Garrigue and Leo White)
  • #2074: Correct naming of record field inside [Ialloc] terms. (Mark Shinwell, review by Jérémie Dimino)
  • #2076: Add [Targetint.print]. (Mark Shinwell)
  • #2080: Add [Proc.dwarf_register_numbers] and [Proc.stack_ptr_dwarf_register_number]. (Mark Shinwell, review by Bernhard Schommer)
  • #2088: Add [Clambda.usymbol_provenance]. (Mark Shinwell, review by Damien Doligez)
  • #2152, #2517: refactorize the fixpoint to compute type-system properties of mutually-recursive type declarations. (Gabriel Scherer and Rodolphe Lepigre, review by Armaël Guéneau)
  • #2156: propagate more type information through Lambda and Clambda intermediate language, as a preparation step for more future optimizations (Pierre Chambart and Alain Frisch, cross-reviewed by themselves)
  • #2160: restore –disable-shared support and ensure testsuite runs correctly when compiled without shared library support. (David Allsopp, review by Damien Doligez and Sébastien Hinderer)
  • * #2173: removed TypedtreeMap (Thomas Refis, review by Gabriel Scherer)
  • #7867: Fix #mod_use raising an exception for filenames with no extension. (Geoff Gole)
  • #2100: Fix Unix.getaddrinfo when called on strings containing null bytes; it would crash the GC later on. (Armaël Guéneau, report and fix by Joe, review by Sébastien Hinderer)
  • #7847, #2019: Fix an infinite loop that could occur when the (Menhir-generated) parser encountered a syntax error in a certain specific state. (François Pottier, report by Stefan Muenzel, review by Frédéric Bour, Thomas Refis, Gabriel Scherer)
  • #1626: Do not allow recursive modules in with module (Leo White, review by Gabriel Radanne)
  • #7726, #1676: Recursive modules, equi-recursive types and stack overflow (Jacques Garrigue, report by Jeremy Yallop, review by Leo White)
  • #7723, #1698: Ensure with module and with type do not weaken module aliases. (Leo White, review by Gabriel Radanne and Jacques Garrigue)
  • #1719: fix Pervasives.LargeFile functions under Windows. (Alain Frisch)
  • #1739: ensure ocamltest waits for child processes to terminate on Windows. (David Allsopp, review by Sébastien Hinderer)
  • #7554, #1751: Lambda.subst: also update debug event environments (Thomas Refis, review by Gabriel Scherer)
  • #7238, #1825: in Unix.in_channel_of_descr and Unix.out_channel_of_descr, raise an error if the given file description is not suitable for character-oriented I/O, for example if it is a block device or a datagram socket. (Xavier Leroy, review by Jérémie Dimino and Perry E. Metzger)
  • #7799, #1820: fix bug where Scanf.format_from_string could fail when the argument string contained characters that require escaping. (Gabriel Scherer and Nicolás Ojeda Bär, report by Guillaume Melquiond, review by Gabriel Scherer)
  • #1843: ocamloptp was doing the wrong thing with option -inline-max-unroll. (Github user @poechsel, review by Nicolás Ojeda Bär).
  • #1890: remove last use of Ctype.unroll_abbrev (Thomas Refis, report by Leo White, review by Jacques Garrigue)
  • #1893: dev-branch only, warning 40(name not in scope) triggered spurious warnings 49(missing cmi) with -no-alias-deps. (Florian Angeletti, report by Valentin Gatien-Baron, review by Gabriel Scherer)
  • #1912: Allow quoted strings, octal/unicode escape sequences and identifiers containing apostrophes in ocamllex actions and comments. (Pieter Goetschalckx, review by Damien Doligez)
  • #7828, #1935: correct the conditions that generate warning 61, Unboxable_type_in_prim_decl (Stefan Muenzel)
  • #1958: allow [module M(_:S) = struct end] syntax (Hugo Heuzard, review by Gabriel Scherer)
  • #1970: fix order of floatting documentation comments in classes (Hugo Heuzard, review by Nicolás Ojeda Bär)
  • #1977: [@@ocaml.warning "…"] attributes attached to type declarations are no longer ignored. (Nicolás Ojeda Bär, review by Gabriel Scherer)
  • #7830, #1987: fix ocamldebug crash when printing a value in the scope of an open statement for which the .cmi is not available. (Nicolás Ojeda Bär, report by Jocelyn Sérot, review by Gabriel Scherer)
  • #7854, #2062: fix an issue where the wrong locale may be used when using the legacy ANSI encoding under Windows. (Nicolás Ojeda Bär, report by Tiphaine Turpin)
  • #2083: Fix excessively aggressive float unboxing and introduce similar fix as a preventative measure for boxed int unboxing. (Thomas Refis, Mark Shinwell, Leo White)
  • #2130: fix printing of type variables with a quote in their name (Alain Frisch, review by Armaël Guéneau and Gabriel Scherer, report by Hugo Heuzard)
  • #2131: fix wrong calls to Env.normalize_path on non-module paths (Alain Frisch, review by Jacques Garrigue)
  • #2175: Apply substitution to all modules when packing (Leo White, review by Gabriel Scherer)
  • #2220: Remove duplicate process management code in otherlibs/threads/unix.ml (Romain Beauxis, review by Gabriel Scherer and Alain Frisch)
  • #2231: Env: always freshen persistent signatures before using them (Thomas Refis and Leo White, review by Gabriel Radanne)
  • #7851, #8570: Module type of allows to transform a malformed module type into a vicious signature, breaking soundness (Jacques Garrigue, review by Leo White)
  • #7923, #2259: fix regression in FlexDLL bootstrapped build caused by refactoring the root Makefile for Dune in #2093) (David Allsopp, report by Marc Lasson)
  • #7929, #2261: Subst.signature: call cleanup_types exactly once (Thomas Refis, review by Gabriel Scherer and Jacques Garrigue, report by Daniel Bünzli and Jon Ludlam)
  • #8550, #8552: Soundness issue with class generalization (Jacques Garrigue, review by Leo White and Thomas Refis, report by Jeremy Yallop)

Dungeon crawler game

Alex Lugo announced

Hey all! I recently made a simple text-based dungeon crawler using a mix functional and object-oriented programming in OCaml. Feel free to check it out if it interests you :) I have a video of the game being played and explained here. You can find the source on GitHub here.

Jbuilder support will stop in one month

Jérémie Dimino announced

This is a reminder that we are planning to stop supporting Jbuilder projects in Dune in July this year, so in about one month time. After this, projects using jbuilder will not be co-installable with the latest version of Dune. If you have a project for which the latest version that is released in opam still depends on jbuilder, you should consider upgrading to dune and submitting a new opam release. Upgrading to Dune can be done automatically via dune upgrade. For more information, please refer to this blog post: https://dune.build/blog/second-step-deprecation/

cstruct 5.0.0 with new capability types

Anil Madhavapeddy announced

Cstruct is a library and syntax extension to make it easier to access C-like structures directly from OCaml. It supports both reading and writing to these structures, and they are accessed via Bigarray.

Hot on the heels of cstruct 4.0.0, I am pleased to announce another major rev cstruct 5.0.0 that adds a new module with more sophisticated types to distinguish between different sorts of buffers. The full changelog is below:

Security: This release tightens bounds checks to ensure that data outside a given view (but still inside the underlying buffer) cannot be accessed.

  • sub does more checks (mirage/ocaml-cstruct#244 mirage/ocaml-cstruct#245 @hannes @talex5 review by @dinosaure)
  • add_len and set_len are now deprecated and will be removed in a future release. (mirage/ocaml-cstruct#251 @hannes)
  • do not add user-provided data for bounds checks (mirage/ocaml-cstruct#253 @hannes, report and review by @talex5)
  • improve CI to add fuzzing (mirage/ocaml-cstruct#255 mirage/ocaml-cstruct#252 @avsm @yomimono @talex5)

Remove Unix dependency: cstruct now uses the new bigarray-compat library instead of Bigarray directly, to avoid a dependency on Unix when using OCaml compilers less than 4.06.0. This will break downstream libraries that do not have a direct dependency on Bigarray. Simply fix it in your library by adding a bigarray dependency in your dune file. (mirage/ocaml-cstruct#247 @TheLortex)

Capability module: To improve the safety of future code with stronger type checking, this release introduces a new Cstruct_cap module which makes the underlying Cstruct an abstract type instead of a record. In return for this extra abstraction, the module can enforce read-only, write only, and read/write buffers by tracking them as phantom type variables. Although this library shares an implementation internally with classic Cstruct, it is a significant revision and so we will be gradually migrating to it. Feedback on it is welcome! (mirage/ocaml-cstruct#237 @dinosaure and many excited reviewers)

Ppx compare functions: A new compare_X function is generated for cenum declarations. This respects custom ids supplied in the cenum declaration and so is more robust than polymorphic compare (mirage/ocaml-cstruct#248 @emillon)

The CI has also been switched over to both Azure Pipelines and Drone in addition to Travis, and as a result the tests all run on Windows, macOS, various Linux distributions, on x86 and arm64 machines, and runs AFL fuzz tests on the Drone cloud (mirage/ocaml-cstruct#255 @avsm).

Old CWN

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.