Team Gallium

Overall Objectives
Scientific Foundations
Application Domains
New Results
Contracts and Grants with Industry
Other Grants and Activities

Section: New Results

Module systems

First-class module systems

Participants : Benoît Montagu, Didier Rémy.

Advanced module systems have now been in use for two decades in modern, statically typed languages. Modules are easy to understand intuitively and also easy to use in simple cases. However, they remain surprisingly hard to formalize and also often become harder to use in larger, more complex but practical examples. In fact, useful features such as recursive modules or mixins are technically challenging and still an active topic of research.

This persisting gap between the apparent simplicity and formal complexity of modules is surprising. We have identified at least two orthogonal sources of width-wise and depth-wise complexity. On the one hand, the stratified presentation of modules as a small calculus of functions and records on top of the underlying base language duplicates the base constructs and therefore complicates the language as a whole. On the other hand, the use of paths to designate abstract types relatively to value variables so as to keep track of sharing pulls the whole not-so-simple formalism of dependent types, even though only a very limited form of dependent types is effectively used.

Our goal is to provide a new presentation of modules that is conceptually more economical while retaining (or increasing) the expressiveness and conciseness of the actual approaches. We rely on first-class modules to avoid duplications of constructs, a new form of open existential types to represent type abstraction, and a new form of paths in types that do not depend on values to preserve the conciseness of writing.

Open existential types improve over existential types with a novel, open-scoped, unpacking construct that is the essence of type abstraction in modules, and can also easily handle recursive modules. This work was presented at the IFIP 2.8 working group and was accepted for presentation at the conference on Principles of Programming Languages (POPL 2009) to be held in Savannah, USA in January 2009  [21] .

Several directions for future work are being considered. One is the study of paths at the type level. Another is to exploit the first-class nature of our approach to increase expressiveness and conciseness of the module sub-language. Finally, we plan to build on the simplicity of the formalism to tackle mixin modules.

Lazy semantics for recursive modules and mixin modules

Participant : Keiko Nakata.

Recursively-defined modules are an extension of the ML module system, found in Objective Caml in particular, that significantly increases the expressive power of this module system. Mixin modules further extend the ML module system with open recursion and the ability to combine and override definitions a posteriori, in the style of class-based object-oriented programming.

Recusive modules and mixin modules raise several challenges, one of which is the definition of a suitable evaluation strategy for computations (initialization code) contained in modules. Keiko Nakata developed evaluation strategies for recursive and mixin modules based on lazy, on-demand evaluation of modules and sub-modules. While expressive and flexible, lazy evaluation makes the order of computations hard to predict by programmers when combined with side effects. Keiko Nakata investigated the use of constraint systems to enable programmers to control evaluation order more precisely. Preliminary results were submitted for publication [35] , [36] .


Logo Inria