EN FR
EN FR


Section: New Results

Programming language design and implementation

The OCaml system

Participants : Damien Doligez, Armaël Guéneau, Xavier Leroy, Luc Maranget, David Allsop [Cambridge University] , Florian Angeletti, Frédéric Bour [Facebook, until Sep 2019] , Stephen Dolan [Cambridge University] , Alain Frisch [Lexifi] , Jacques Garrigue [Nagoya University] , Sébastien Hinderer [SED] , Nicolás Ojeda Bär [Lexifi] , Gabriel Radanne, Thomas Refis [Jane Street] , Gabriel Scherer [Inria team Parsifal] , Mark Shinwell [Jane Street] , Leo White [Jane Street] , Jeremy Yallop [Cambridge University] .

This year, we released four versions of the OCaml system: versions 4.08.0, 4.08.1, 4.09.0, and 4.09.1. Versions 4.08.1 and 4.09.1 are minor releases that respectively fix 6 and 5 issues. Versions 4.08.0 and 4.09.0 are major releases that introduce new language features, improve performance and usability, and fix about 50 issues. The main novelties are:

  • User-defined binding operators are now supported, with syntax similar to let* , let+ , and* . These operators make it much easier to write OCaml code in monadic style or using applicative structures.

  • The open construct now applies to arbitrary module expressions in structures and to applicative paths in signatures.

  • A new notion of user-defined “alerts” generalizes the “deprecated” warning.

  • New modules were added to the standard library: Fun , Bool , Int , Option , Result .

  • Many floating-point functions were added, including fused multiply-add, as well as a new Float.Array submodule.

  • Many error messages were improved, as well as error and warning reporting mechanisms.

  • Pattern-matching constructs that correspond to affine functions are now optimized into arithmetic computations.

Evolution of the OCaml type system

Participants : Florian Angeletti, Jacques Garrigue, Thomas Refis [Jane Street] , Didier Rémy, Gabriel Radanne, Gabriel Scherer [Inria team Parsifal] , Leo White [Jane Street] .

In addition to the work done on the above releases, efforts have been done to improve the type system and its implementation. Those include:

  • Formalizing the typing of the pattern-matching of generalized algebraic data types (GADTs).

  • Fixing some issues related to the incompleteness of the treatment of GADTs.

  • Proposing extensions of the type system to reduce this incompleteness in concrete cases, by refining the information on abstract types.

  • Exploring practical ways to obtain more polymorphism for functions whose soundness does not rely on the value restriction.

  • Improving the readability of the type-checker code.

  • Making the module layer of the type-checker more incremental, in order to improve efficiency and to facilitate integration with documentation tools.

Refactoring with ornaments in ML

Participants : Didier Rémy, Thomas Williams [Google Paris] .

Thomas Williams, Lucas Baudin, and Didier Rémy have been working on refactoring and other transformations of ML programs based on mixed ornamentation and disornamentation. Ornaments have been introduced as a way of describing changes in data type definitions that can reorganize or add pieces of data. After a new data structure has been described as an ornament of an older one, the functions that operate on the bare structure can be partially or sometimes totally lifted into functions that operate on the ornamented structure.

This year, Williams and Rémy improved the formalization of the lifting framework. In particular, they introduced an intermediate language, in which nonexpansive expressions can be marked on source terms and traced during reduction. This allows to treat the nonexpansive part of expansive expressions as nonexpansive and use equational reasoning on nonexpansive parts of terms that appear in types. This approach significantly simplifies the metatheory of ornaments. This calculus could also have some interest in itself, beyond ornaments, to study languages with side effects.

A better treatment of type abbreviations during type inference

Participants : Didier Rémy, Carine Morel.

During her M2 internship under the supervision of Didier Rémy, Carine Morel revisited the treatment of type abbreviations in type inference for ML-like type systems, using a modern approach based on typing constraints [24]. Instead of expanding type abbreviations prior to unification, both the original abbreviated view and all expanded views are kept during unification, so as to avoid unnecessary expansions and use the least-expanded view whenever possible in the result of unification.