# OCaml 4.09.0 released

**URL:** <https://discuss.ocaml.org/t/ocaml-4-09-0-released/4384>\
**Category:** Ecosystem\
**Created:** [September 19, 2019, 8:54am UTC](https://discuss.ocaml.org/t/ocaml-4-09-0-released/4384 "2019-09-19T08:54:47Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [September 19, 2019, 8:54am UTC](https://discuss.ocaml.org/t/ocaml-4-09-0-released/4384/1 "2019-09-19T08:54:47Z")

</div>

The OCaml team have the pleasure of celebrating the birth of James Waddell Alexander II  
by announcing the release of OCaml version 4.09.0 .

Some of the highlights of this new 4.09 release are:

- New optimisations, in particular for affine functions in matches, for instance

```auto
    type t = A | B | C
    let affine = function
      | A -> 4
      | B -> 3
      | C -> 2

```

- The `graphics` library was moved out of the compiler distribution.
- The `vmthread` library was removed.
- Support for compiler plugins was removed.
- Many bug fixes.

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

It is available as a set of OPAM switches, and as a source download here:

[https://caml.inria.fr/pub/distrib/ocaml-4.09/](https://caml.inria.fr/pub/distrib/ocaml-4.09/)

Happy hacking.

* * *

## Changes

This is the [changelog](http://caml.inria.fr/pub/distrib/ocaml-4.09/notes/Changes) .

### Runtime system:

- (_breaking change_) [#1725](https://github.com/ocaml/ocaml/issues/1725), [#2279](https://github.com/ocaml/ocaml/issues/2279): Deprecate Obj.set\_tag and Obj.truncate  
(Stephen Dolan, review by Gabriel Scherer, Damien Doligez and Xavier Leroy)

- (_breaking change_) [#2240](https://github.com/ocaml/ocaml/issues/2240): Constify “identifier” in struct custom\_operations  
(Cedric Cellier, review by Xavier Leroy)

- (_breaking change_) [#2293](https://github.com/ocaml/ocaml/issues/2293): Constify “caml\_named\_value”  
(Stephen Dolan, review by Xavier Leroy)

- [#8787](https://github.com/ocaml/ocaml/issues/8787), [#8788](https://github.com/ocaml/ocaml/issues/8788): avoid integer overflow in caml\_output\_value\_to\_bytes  
(Jeremy Yallop, report by Marcello Seri)

- [#2075](https://github.com/ocaml/ocaml/issues/2075), [#7729](https://github.com/ocaml/ocaml/issues/7729): rename \_T macro used to support Unicode in the (Windows) runtime  
in order to avoid compiler warning  
(Nicolás Ojeda Bär, review by Gabriel Scherer and David Allsopp)

- [#2250](https://github.com/ocaml/ocaml/issues/2250): Remove extra integer sign-extension in compare functions  
(Stefan Muenzel, review by Xavier Leroy)

- [#8607](https://github.com/ocaml/ocaml/issues/8607): Remove obsolete macros for pre-2002 MSVC support  
(Stephen Dolan, review by Nicolás Ojeda Bär and David Allsopp)

- [#8656](https://github.com/ocaml/ocaml/issues/8656): Fix a bug in [caml\_modify\_generational\_global\_root]  
(Jacques-Henri Jourdan, review by Gabriel Scherer)

### Standard library:

- [#2262](https://github.com/ocaml/ocaml/issues/2262): take precision (.) and flags (’+’ and ’ ') into account  
in printf %F  
(Pierre Roux, review by Gabriel Scherer)

- [#6148](https://github.com/ocaml/ocaml/issues/6148), [#8596](https://github.com/ocaml/ocaml/issues/8596): optimize some buffer operations  
(Damien Doligez, reports by John Whitington and Alain Frisch,  
review by Jeremy Yallop and Gabriel Scherer)

### Other libraries:

- (_breaking change_) [#2318](https://github.com/ocaml/ocaml/issues/2318): Delete the graphics library. This library is now available  
as a separate “graphics” package in opam. Its new home is:  
[https://github.com/ocaml/graphics](https://github.com/ocaml/graphics)  
(Jérémie Dimino, review by Nicolas Ojeda Bar, Xavier Leroy and  
Sébastien Hinderer)

- (_breaking change_) [#2289](https://github.com/ocaml/ocaml/issues/2289): Delete the vmthreads library. This library was deprecated in 4.08.0.  
(Jérémie Dimino)

- [#2112](https://github.com/ocaml/ocaml/issues/2112): Fix Thread.yield unfairness with busy threads yielding to each  
other.  
(Andrew Hunter, review by Jacques-Henri Jourdan, Spiros Eliopoulos, Stephen  
Weeks, & Mark Shinwell)

- [#7903](https://github.com/ocaml/ocaml/issues/7903), [#2306](https://github.com/ocaml/ocaml/issues/2306): Make Thread.delay interruptible by signals again  
(Xavier Leroy, review by Jacques-Henri Jourdan and Edwin Török)

- [#2248](https://github.com/ocaml/ocaml/issues/2248): Unix alloc\_sockaddr: Fix read of uninitialized memory for an  
unbound Unix socket. Add support for receiving abstract (Linux) socket paths.  
(Tim Cuthbertson, review by Sébastien Hinderer and Jérémie Dimino)

### Compiler user-interface and warnings:

- (_breaking change_) [#2276](https://github.com/ocaml/ocaml/issues/2276): Remove support for compiler plugins and hooks (also adds  
[Dynlink.unsafe\_get\_global\_value])  
(Mark Shinwell, Xavier Clerc, review by Nicolás Ojeda Bär,  
Florian Angeletti, David Allsopp and Xavier Leroy)

- [#2301](https://github.com/ocaml/ocaml/issues/2301): Hint on type error on int literal  
(Jules Aguillon, review by Nicolás Ojeda Bär , Florian Angeletti,  
Gabriel Scherer and Armaël Guéneau)

- (_breaking change_) [#2314](https://github.com/ocaml/ocaml/issues/2314): Remove support for gprof profiling.  
(Mark Shinwell, review by Xavier Clerc and Stephen Dolan)

- [#2190](https://github.com/ocaml/ocaml/issues/2190): fix pretty printing (using Pprintast) of “lazy …” patterns and  
“fun (type t) -\> …” expressions.  
(Nicolás Ojeda Bär, review by Gabriel Scherer)

- [#2277](https://github.com/ocaml/ocaml/issues/2277): Use newtype names as type variable names  
The inferred type of (fun (type t) (x : t) -\> x)  
is now printed as ('t -\> 't) rather than ('a -\> 'a).  
(Matthew Ryan)

- [#2309](https://github.com/ocaml/ocaml/issues/2309): New options -with-runtime and -without-runtime in ocamlopt/ocamlc  
that control the inclusion of the runtime system in the generated program.  
(Lucas Pluvinage, review by Daniel Bünzli, Damien Doligez, David Allsopp  
and Florian Angeletti)

- [#3819](https://github.com/ocaml/ocaml/issues/3819), [#8546](https://github.com/ocaml/ocaml/issues/8546) more explanations and tests for illegal permutation  
(Florian Angeletti, review by Gabriel Scherer)

- [#8537](https://github.com/ocaml/ocaml/issues/8537): fix the -runtime-variant option for bytecode  
(Damien Doligez, review by David Allsopp)

- [#8541](https://github.com/ocaml/ocaml/issues/8541): Correctly print multi-lines locations  
(Louis Roché, review by Gabriel Scherer)

- [#8579](https://github.com/ocaml/ocaml/issues/8579): Better error message for private constructors  
of an extensible variant type  
(Guillaume Bury, review by many fine eyes)

### Code generation and optimizations:

- [#2278](https://github.com/ocaml/ocaml/issues/2278): Remove native code generation support for 32-bit Intel macOS,  
iOS and other Darwin targets.  
(Mark Shinwell, review by Nicolas Ojeda Bar and Xavier Leroy)

- [#8547](https://github.com/ocaml/ocaml/issues/8547): Optimize matches that are an affine function of the input.  
(Stefan Muenzel, review by Alain Frisch, Gabriel Scherer)

- [#1904](https://github.com/ocaml/ocaml/issues/1904), [#7931](https://github.com/ocaml/ocaml/issues/7931): Add FreeBSD/aarch64 support  
(Greg V, review by Sébastien Hinderer, Stephen Dolan, Damien Doligez  
and Xavier Leroy)

- [#8507](https://github.com/ocaml/ocaml/issues/8507): Shorten symbol names of anonymous functions in Flambda mode  
(the directory portions are now hidden)  
(Mark Shinwell, review by Nicolás Ojeda Bär)

- [#8681](https://github.com/ocaml/ocaml/issues/8681), [#8699](https://github.com/ocaml/ocaml/issues/8699), [#8712](https://github.com/ocaml/ocaml/issues/8712): Fix code generation with nested let rec of functions.  
(Stephen Dolan, Leo White, Gabriel Scherer and Pierre Chambart,  
review by Gabriel Scherer, reports by Alexey Solovyev and Jonathan French)

### Manual and documentation:

- [#7584](https://github.com/ocaml/ocaml/issues/7584), [#8538](https://github.com/ocaml/ocaml/issues/8538): Document .cmt\* files in the “overview” of ocaml{c,opt}  
(Oxana Kostikova, rewiew by Florian Angeletti)

- [#8757](https://github.com/ocaml/ocaml/issues/8757): Rename Pervasives to Stdlib in core library documentation.  
(Ian Zimmerman, review by David Allsopp)

- [#8515](https://github.com/ocaml/ocaml/issues/8515): manual, precise constraints on reexported types  
(Florian Angeletti, review by Gabriel Scherer)

### Tools:

- [#2221](https://github.com/ocaml/ocaml/issues/2221): ocamldep will now correctly allow a .ml file in an include directory  
that appears first in the search order to shadow a .mli appearing in a later  
include directory.  
(Nicolás Ojeda Bär, review by Florian Angeletti)

### Internal/compiler-libs changes:

- [#1579](https://github.com/ocaml/ocaml/issues/1579): Add a separate types for clambda primitives  
(Pierre Chambart, review by Vincent Laviron and Mark Shinwell)

- [#1965](https://github.com/ocaml/ocaml/issues/1965): remove loop constructors in Cmm and Mach  
(Vincent Laviron)

- [#1973](https://github.com/ocaml/ocaml/issues/1973): fix compilation of catches with multiple handlers  
(Vincent Laviron)

- [#2228](https://github.com/ocaml/ocaml/issues/2228), [#8545](https://github.com/ocaml/ocaml/issues/8545): refactoring the handling of .cmi files  
by moving the logic from Env to a new module Persistent\_env  
(Gabriel Scherer, review by Jérémie Dimino and Thomas Refis)

- [#2229](https://github.com/ocaml/ocaml/issues/2229): Env: remove prefix\_idents cache  
(Thomas Refis, review by Frédéric Bour and Gabriel Scherer)

- [#2237](https://github.com/ocaml/ocaml/issues/2237), [#8582](https://github.com/ocaml/ocaml/issues/8582): Reorder linearisation of Trywith to avoid a call instruction  
(Vincent Laviron and Greta Yorsh, additional review by Mark Shinwell;  
fix in [#8582](https://github.com/ocaml/ocaml/issues/8582) by Mark Shinwell, Xavier Leroy and Anil Madhavapeddy)

- [#2265](https://github.com/ocaml/ocaml/issues/2265): Add bytecomp/opcodes.mli  
(Mark Shinwell, review by Nicolas Ojeda Bar)

- [#2268](https://github.com/ocaml/ocaml/issues/2268): Improve packing mechanism used for building compilerlibs modules  
into the Dynlink libraries  
(Mark Shinwell, Stephen Dolan, review by David Allsopp)

- [#2280](https://github.com/ocaml/ocaml/issues/2280): Don’t make more Clambda constants after starting Cmmgen  
(Mark Shinwell, review by Vincent Laviron)

- [#2281](https://github.com/ocaml/ocaml/issues/2281): Move some middle-end files around  
(Mark Shinwell, review by Pierre Chambart and Vincent Laviron)

- [#2283](https://github.com/ocaml/ocaml/issues/2283): Add [is\_prefix] and [find\_and\_chop\_longest\_common\_prefix] to  
[Misc.Stdlib.List]  
(Mark Shinwell, review by Alain Frisch and Stephen Dolan)

- [#2284](https://github.com/ocaml/ocaml/issues/2284): Add various utility functions to [Misc] and remove functions  
from [Misc.Stdlib.Option] that are now in [Stdlib.Option]  
(Mark Shinwell, review by Thomas Refis)

- [#2286](https://github.com/ocaml/ocaml/issues/2286): Functorise [Consistbl]  
(Mark Shinwell, review by Gabriel Radanne)

- [#2291](https://github.com/ocaml/ocaml/issues/2291): Add [Compute\_ranges] pass  
(Mark Shinwell, review by Vincent Laviron)

- [#2292](https://github.com/ocaml/ocaml/issues/2292): Add [Proc.frame\_required] and [Proc.prologue\_required].  
Move tail recursion label creation to [Linearize]. Correctly position  
[Lprologue] relative to [Iname\_for\_debugger] operations.  
(Mark Shinwell, review by Vincent Laviron)

- [#2308](https://github.com/ocaml/ocaml/issues/2308): More debugging information on [Cmm] terms  
(Mark Shinwell, review by Stephen Dolan)

- [#7878](https://github.com/ocaml/ocaml/issues/7878), [#8542](https://github.com/ocaml/ocaml/issues/8542): Replaced TypedtreeIter with tast\_iterator  
(Isaac “Izzy” Avram, review by Gabriel Scherer and Nicolás Ojeda Bär)

- [#8598](https://github.com/ocaml/ocaml/issues/8598): Replace “not is\_nonexpansive” by “maybe\_expansive”.  
(Thomas Refis, review by David Allsopp, Florian Angeletti, Gabriel Radanne,  
Gabriel Scherer and Xavier Leroy)

### Compiler distribution build system:

- [#2267](https://github.com/ocaml/ocaml/issues/2267): merge generation of header programs, also fixing parallel build on  
Cygwin.  
(David Allsopp, review by Sébastien Hinderer)

- [#8514](https://github.com/ocaml/ocaml/issues/8514): Use boot/ocamlc.opt for building, if available.  
(Stephen Dolan, review by Gabriel Scherer)

### Bug fixes:

- [#8864](https://github.com/ocaml/ocaml/issues/8864), [#8865](https://github.com/ocaml/ocaml/issues/8865): Fix native compilation of left shift by (word\_size - 1)  
(Vincent Laviron, report by Murilo Giacometti Rocha, review by Xavier Leroy)

- [#2296](https://github.com/ocaml/ocaml/issues/2296): Fix parsing of hexadecimal floats with underscores in the exponent.  
(Hugo Heuzard and Xavier Leroy, review by Gabriel Scherer)

- [#8800](https://github.com/ocaml/ocaml/issues/8800): Fix soundness bug in extension constructor inclusion  
(Leo White, review by Jacques Garrigue)

- [#8848](https://github.com/ocaml/ocaml/issues/8848): Fix x86 stack probe CFI information in caml\_c\_call and  
caml\_call\_gc  
(Tom Kelly, review by Xavier Leroy)

- [#7156](https://github.com/ocaml/ocaml/issues/7156), [#8594](https://github.com/ocaml/ocaml/issues/8594): make top level use custom printers if they are available  
(Andrew Litteken, report by Martin Jambon, review by Nicolás Ojeda Bär,  
Thomas Refis, Armaël Guéneau, Gabriel Scherer, David Allsopp)

- [#3249](https://github.com/ocaml/ocaml/issues/3249): ocamlmklib should reject .cmxa files  
(Xavier Leroy)

- [#7937](https://github.com/ocaml/ocaml/issues/7937), [#2287](https://github.com/ocaml/ocaml/issues/2287): fix uncaught Unify exception when looking for type  
declaration  
(Florian Angeletti, review by Jacques Garrigue)

- [#8610](https://github.com/ocaml/ocaml/issues/8610), [#8613](https://github.com/ocaml/ocaml/issues/8613): toplevel printing, consistent deduplicated name for types  
(Florian Angeletti, review by Thomas Refis and Gabriel Scherer,  
reported by Xavier Clerc)

- [#8635](https://github.com/ocaml/ocaml/issues/8635), [#8636](https://github.com/ocaml/ocaml/issues/8636): Fix a bad side-effect of the -allow-approx option of  
ocamldep. It used to turn some errors into successes  
(Jérémie Dimino)

- [#8701](https://github.com/ocaml/ocaml/issues/8701), [#8725](https://github.com/ocaml/ocaml/issues/8725): Variance of constrained parameters causes principality issues  
(Jacques Garrigue, report by Leo White, review by Gabriel Scherer)

- [#8777](https://github.com/ocaml/ocaml/issues/8777)(partial): fix position information in some polymorphic variant  
error messages about missing tags  
(Florian Angeletti, review by Thomas Refis)

- [#8779](https://github.com/ocaml/ocaml/issues/8779), more cautious variance computation to avoid missing cmis  
(Florian Angeletti, report by Antonio Nuno Monteiro, review by Leo White)

- [#8810](https://github.com/ocaml/ocaml/issues/8810): Env.lookup\_module: don’t allow creating loops  
(Thomas Refis, report by Leo White, review by Jacques Garrigue)

- [#8862](https://github.com/ocaml/ocaml/issues/8862), [#8871](https://github.com/ocaml/ocaml/issues/8871): subst: preserve scopes  
(Thomas Refis, report by Leo White, review by Jacques Garrigue)

- [#8921](https://github.com/ocaml/ocaml/issues/8921), [#8924](https://github.com/ocaml/ocaml/issues/8924): Fix stack overflow with Flambda  
(Vincent Laviron, review by Pierre Chambart and Leo White,  
report by Aleksandr Kuzmenko)

- [#8944](https://github.com/ocaml/ocaml/issues/8944): Fix “open struct … end” on clambda backend  
(Thomas Refis, review by Leo White, report by Damon Wang and Mark Shinwell)

---

_[View the full topic](https://discuss.ocaml.org/t/ocaml-4-09-0-released/4384)._
