Derek
Dreyer
Max Planck
Institute for Software Systems
Mixin'
Up the ML Module System
Abstract:
ML modules support hierarchical namespace management, as well as both
abstract and transparent type components, but they do not support
recursive linking of separately compiled modules. Mixin modules
support recursive linking of separately compiled modules, but they are
not hierarchically composable and typically do not contain type
components, abstract or otherwise. We synthesize the
complementary
advantages of these two mechanisms in a new, unified module system
design called MixML. A MixML module is like an ML structure in
which
some of the components are specified but not defined. In other
words,
it unifies the ML structure and signature languages into one.
MixML
seamlessly integrates hierarchical composition, translucent data
abstraction, and mixin-style recursive linking. The design of
MixML
is minimalist, emphasizing how superficially distinct features of the
ML module system can be modeled as stylized uses of the same
underlying constructs, with mixin composition playing a central
role.
Of particular note is the treatment of ML's "sealing" construct.
Sealing and mixin composition are viewed as two sides of the same
coin---opaque linking vs. transparent linking---with remarkably
similar typing rules.