Team Gallium

Members
Overall Objectives
Scientific Foundations
Application Domains
Software
New Results
Contracts and Grants with Industry
Other Grants and Activities
Dissemination
Bibliography

Section: New Results

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 the theory of singleton kinds to handle type definitions and 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 POPL 2009 symposium [5] . The soundness proof of the core system was mechanically verified with the Coq proof assistant. The formal proof and the issues related to the technology that was used to deal with binders were presented at the Workshop on Mechanizing Metatheory in Baltimore in September 2010 [31] . The Coq development is publicly available at http://gallium.inria.fr/~montagu/proofs/FzipCore/FzipCore.tar.bz2 .

Benoît Montagu studied systems equipped with singleton kinds, and gave a characterization of type equivalence, based on $ \beta$$ \eta$ -equivalence and proved correct and complete. As in other works on this topic, the unfolding of type definitions is understood as an $ \eta$ -expansion step at a singleton kind. The novelty of the work lies in the definition of a small-step reduction relation that features $ \beta$ -reduction and $ \eta$ -expansion, while remaining confluent and strongly normalizing on wellformed types. The key ingredient is making the $ \eta$ -expansion points explicit in the syntax. This characterization has the advantage of being more flexible and easier to understand than the known algorithms for computing normal forms and deciding equivalence. It can also lead to simpler algorithms.

Benoît Montagu defined a language, called Fzip-full, that features open existential types, singleton kinds, and subtyping, and that can serve as an explicitly-typed core language for modules. He described a translation from a module language to Fzip-full, that shows the similar degree of verbosity of the two languages. A basic typechecker for Fzip-full was developed. It is available at http://gallium.inria.fr/~montagu/thesis/fzip.tar.bz2 .

This work is fully described in Benoît Montagu's Ph.D. thesis [12] , which was defended in December 2010.


previous
next

Logo Inria