Section: New Results

The OCaml language and system

The OCaml system

Participants : Xavier Clerc [team SED] , Damien Doligez, Alain Frisch [Lexifi SAS] , Jacques Garrigue [University of Nagoya] , Fabrice Le Fessant [Inria Saclay and OCamlPro start-up company] , Jacques Le Normand [Lexifi SAS] , Xavier Leroy.

This year, we released versions 4.00.0 and 4.00.1 of the OCaml system. Version 4.00.0 (released in July) is a major release that fixes about 150 reported bugs and 4 unreported bugs, and introduces 57 new features suggested by users. Version 4.00.1 (released in October) is a bug-fix release that fixes 3 major and 20 minor bugs. Damien Doligez acted as release manager for both versions.

The major innovation in OCaml 4.00 is support for generalized algebraic datatypes (GADTs). These non-uniform datatype definitions enable programmers to express some invariants over data structures, and the OCaml type-checker to enforce these invariants. They also support interesting ways of reflecting types into run-time values. GADTs are found in proof assistants such as Coq and in functional languages such as Agda and Haskell. Their integration in OCaml raised delicate issues of partial type inference and principality of inferred types, to which Jacques Garrigue and Jacques Le Normand provided original solutions [45] .

Other features of this release include:

  • Lightweight notations to facilitate the use of first-class modules.

  • Better reporting of type errors.

  • Improvements in native-code generation.

  • Performance and security improvements in the hashing primitive and hash tables.

  • New warnings for unused code (variables, record fields, etc.)

  • A new back-end for the ARM architecture.

Namespaces for OCaml

Participants : Gabriel Scherer, Didier Rémy, Fabrice Le Fessant [Inria Saclay] .

As part of an ongoing discussion among members of the OCaml Consortium, we investigated the formal aspects of “namespaces” and their putative status in the OCaml language. Namespaces aim at providing OCaml programmers with efficient ways to manage and structure the names of compilation units, in contrast with the flat, global space of compilation units provided today in OCaml. This formalization provides scientific support to ongoing design and engineering discussions. It was presented at the December 2011 IFIP 2.8 working group on functional programming, and at the December 2012 meeting of the OCaml Consortium.