Abstract
ML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules facilitate recursive linking of separately compiled components, but they are not hierarchically composable and typically do not support type abstraction. We synthesize the complementary advantages of these two mechanisms in a novel module system design we call 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 ML-style data abstraction, and mixin-style recursive linking. Moreover, the design of MixML is clean and minimalist; it emphasizes how all the salient, semantically interesting features of the ML module system (and several proposed extensions to it) can be understood simply as stylized uses of a small set of orthogonal underlying constructs, with mixin composition playing a central role.
We provide a declarative type system for MixML, including two important extensions: higher-order modules, and modules as first-class values. We also present a sound and complete, three-pass type-checking algorithm for this system. The operational semantics of MixML is defined by an elaboration translation into an internal core language called LTG---namely, a polymorphic lambda calculus with single-assignment references and recursive type generativity---which employs a linear type and kind system to track definedness of term and type imports.
- Abadi, M. and Cardelli, L. 1996. A Theory of Objects. Springer, New York. Google ScholarDigital Library
- Ahmed, A. 2006. Step-indexed syntactic logical relations for recursive and quantified types. In Proceedings of the European Symposium on Programming (ESOP’06). Springer. Google ScholarDigital Library
- Ahmed, A., Fluet, M., and Morrisett, G. 2005. A step-indexed model for substructural state. In Proceedings of the International Conference on Functional Programming (ICFP’05). ACM Press, New York. Google ScholarDigital Library
- Ancona, D. and Zucca, E. 1998. A theory of mixin modules: Basic and derived operators. Math. Struct. Comput. Sci. 8, 4, 401--446. Google ScholarDigital Library
- Ancona, D. and Zucca, E. 2002. A calculus of module systems. J. Funct. Program. 12, 2, 91--132. Google ScholarDigital Library
- Ancona, D., Fagorzi, S., Moggi, E., and Zucca, E. 2003. Mixin modules and computational effects. In Proceedings of the International Colloquium on Automata, Languages and Programming (ICALP’03). Springer. Google ScholarDigital Library
- Appel, A. and McAllester, D. 2001. An indexed model of recursive types for foundational proof-carrying code. ACM Trans. Program. Lang. Syst. 23, 5, 657--683. Google ScholarDigital Library
- Bracha, G. and Cook, W. 1990. Mixin-based inheritance. In Proceedings of the Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’90). ACM Press, New York. Google ScholarDigital Library
- Bracha, G. and Lindstrom, G. 1992. Modularity meets inheritance. In Proceedings of the International Conference on Computer Languages (ICCL’92). IEEE.Google Scholar
- Bracha, G., Ahe, P., Bykov, V., Kashai, Y., Maddox, W., and Miranda, E. 2010. Modules as objects in Newspeak. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP’10). ACM Press, New York. Google ScholarDigital Library
- Crary, K., Harper, R., and Puri, S. 1999. What is a recursive module? In Proceedings of the ACM SIGPLAN Conference on Principles of Language Design and Implementation (PLDI’99). ACM Press, New York. Google ScholarDigital Library
- Cremet, V., Garillot, F., Lenglet, S., and Odersky, M. 2006. A core calculus for Scala type checking. In Proceedings of the International Symposium on Mathematical Foundations of Computer Science (MFCS’06). Springer. Google ScholarDigital Library
- Dreyer, D. 2004. A type system for well-founded recursion. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’04). ACM Press, New York. Google ScholarDigital Library
- Dreyer, D. 2005. Understanding and evolving the ML module system. Ph.D. thesis, Carnegie Mellon University, Pittsburgh, PA. Google ScholarDigital Library
- Dreyer, D. 2007a. Recursive type generativity. J. Funct. Program. 17, 4--5, 433--471. Google ScholarDigital Library
- Dreyer, D. 2007b. A type system for recursive modules. In Proceedings of the International Conference on Functional Programming (ICFP’07). ACM Press, New York. Google ScholarDigital Library
- Dreyer, D. and Rossberg, A. 2008. Mixin’ up the ML module system. In Proceedings of the International Conference on Functional Programming (ICFP’08). ACM Press, New York. Google ScholarDigital Library
- Dreyer, D., Crary, K., and Harper, R. 2003. A type system for higher-order modules. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’03). ACM Press, New York. Google ScholarDigital Library
- Dreyer, D., Harper, R., and Chakravarty, M. M. T. 2007. Modular type classes. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’07). ACM Press, New York. Google ScholarDigital Library
- Duggan, D. 2002. Type-safe linking with recursive DLLs and shared libraries. ACM Trans. Program. Lang. Syst. 24, 6, 711--804. Google ScholarDigital Library
- Duggan, D. and Sourelis, C. 1996. Mixin modules. In Proceedings of the International Conference on Functional Programming (ICFP’96). ACM Press, New York. Google ScholarDigital Library
- Flatt, M. and Felleisen, M. 1998. Units: Cool modules for HOT languages. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI’98). ACM Press, New York. Google ScholarDigital Library
- Harper, R. 2011. Programming in Standard ML. Working draft, Carnegie Mellon University, Pittsburgh, PA.Google Scholar
- Harper, R. and Lillibridge, M. 1994. A type-theoretic approach to higher-order modules with sharing. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’94). ACM Press, New York. Google ScholarDigital Library
- Harper, R. and Mitchell, J. C. 1993. On the type structure of Standard ML. ACM Trans. Program. Lang. Syst. 15, 2, 211--252. Google ScholarDigital Library
- Harper, R. and Pierce, B. C. 2005. Design considerations for ML-style module systems. In Advanced Topics in Types and Programming Languages, B. C. Pierce Ed., MIT Press, Cambridge, MA.Google Scholar
- Harper, R. and Stone, C. 2000. A type-theoretic interpretation of Standard ML. In Proof, Language, and Interaction: Essays in Honor of Robin Milner, G. Plotkin, C. Stirling, and M. Tofte Eds., MIT Press, Cambridge, MA. Google ScholarDigital Library
- Harper, R., Mitchell, J. C., and Moggi, E. 1990. Higher-order modules and the phase distinction. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’90). ACM Press, New York. Google ScholarDigital Library
- Hirschowitz, T. and Leroy, X. 2005. Mixin modules in a call-by-value setting. ACM Trans. Program. Lang. Syst. 27, 5, 857--881. Google ScholarDigital Library
- Im, H., Nakata, K., Garrigue, J., and Park, S. 2011. A syntactic type system for recursive modules. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’11). ACM Press, New York. Google ScholarDigital Library
- Jones, M. P. 1996. Using parameterized signatures to express modular structure. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’96). ACM Press, New York. Google ScholarDigital Library
- Leroy, X. 1994. Manifest types, modules, and separate compilation. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’94). ACM Press, New York. Google ScholarDigital Library
- Leroy, X. 1995. Applicative functors and fully transparent higher-order modules. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’95). ACM Press, New York. Google ScholarDigital Library
- Leroy, X. 2000. A modular module system. J. Funct. Program. 10, 3, 269--303. Google ScholarDigital Library
- Leroy, X. 2003. A proposal for recursive modules in Objective Caml. http://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf.Google Scholar
- MacQueen, D. 1984. Modules for Standard ML. In Proceedings of the ACM Conference on LISP and Functional Programming (LFP’84). ACM Press, New York. Google ScholarDigital Library
- Mazurak, K., Zhao, J., and Zdancewic, S. 2010. Lightweight linear types in System F°. In Proceedings of the ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI’10). ACM Press, New York. Google ScholarDigital Library
- Milner, R., Tofte, M., Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (revised). MIT Press, Cambridge, MA. Google ScholarDigital Library
- Montagu, B. and Rémy, D. 2009. Modeling abstract types in modules with open existential types. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’09). ACM Press, New York. 354--365. Google ScholarDigital Library
- Moon, D. A. 1986. Object-oriented programming with Flavors. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’86). ACM Press, New York. Google ScholarDigital Library
- Nakata, K. and Garrigue, J. 2006. Recursive modules for programming. In Proceedings of the International Conference on Functional Programming (ICFP’06). ACM Press, New York. Google ScholarDigital Library
- Neis, G., Dreyer, D., and Rossberg, A. 2011. Non-parametric parametricity. J. Funct. Program. 21, 4--5, 497--562. Google ScholarDigital Library
- Nystrom, N., Chong, S., and Myers, A. 2004. Scalable extensibility via nested inheritance. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’04). ACM Press, New York. Google ScholarDigital Library
- Nystrom, N., Qi, X., and Myers, A. 2006. J&: Nested intersection for scalable software composition. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’06). ACM Press, New York. Google ScholarDigital Library
- Odersky, M. and Zenger, M. 2005. Scalable component abstractions. In Proceedings of the ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA’05). ACM Press, New York. Google ScholarDigital Library
- Odersky, M., Cremet, V., Röckl, C., and Zenger, M. 2003. A nominal theory of objects with dependent types. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP’03). ACM Press, New York.Google Scholar
- Owens, S. and Flatt, M. 2006. From structures and functors to modules and units. In Proceedings of the International Conference on Functional Programming (ICFP’06). ACM Press, New York. Google ScholarDigital Library
- Peyton Jones, S. S., Augustsson, L., Barton, D., Boutel, B., Burton, W., Fasel, J., et al. 2003. Haskell 98 language and libraries: The revised report. J. Funct. Program. 13, 1, i--255.Google ScholarDigital Library
- Ramsey, N., Fisher, K., and Govereau, P. 2005. An expressive language of signatures. In Proceedings of the International Conference on Functional Programming (ICFP’05). ACM Press, New York. Google ScholarDigital Library
- Rossberg, A. 2003. Generativity and dynamic opacity for abstract types. In Proceedings of the International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP’03). ACM Press, New York. Google ScholarDigital Library
- Rossberg, A. 2006. The missing link: Dynamic components for ML. In Proceedings of the International Conference on Functional Programming (ICFP’06). ACM Press, New York. Google ScholarDigital Library
- Rossberg, A. and Dreyer, D. 2008. MixML (project website). http://www.mpi-sws.mpg.de/~rossberg/mixml/.Google Scholar
- Rossberg, A., Russo, C. V., and Dreyer, D. 2010. F-ing modules. In Proceedings of the ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI’10). ACM Press, New York. Google ScholarDigital Library
- Russo, C. V. 1998. Types for modules. Ph.D. thesis, University of Edinburgh.Google Scholar
- Russo, C. V. 1999a. First-class structures for Standard ML. In Proceedings of the International Conference on Functional Programming (ICFP’99). ACM Press, New York.Google Scholar
- Russo, C. V. 1999b. Non-dependent types for Standard ML modules. In Proceedings of the International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP’99). Springer. Google ScholarDigital Library
- Russo, C. V. 2001. Recursive structures for Standard ML. In Proceedings of the International Conference on Functional Programming (ICFP’01). ACM Press, New York. Google ScholarDigital Library
- Stone, C. A. and Harper, R. 2006. Extensional equivalence and singleton types. ACM Trans. Comput. Logic 7, 4, 676--722. Google ScholarDigital Library
- Wadler, P. 1990. Linear types can change the world! In Programming Concepts and Methods, M. Broy and C. Jones Eds., North Holland.Google Scholar
- Wadler, P. and Blott, S. 1989. How to make ad hoc polymorphism less ad hoc. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL’89). ACM Press, New York. Google ScholarDigital Library
- Walker, D. 2005. Substructural type systems. In Advanced Topics in Types and Programming Languages, B. C. Pierce Ed., MIT Press, Cambridge, MA.Google Scholar
Index Terms
- Mixin’ Up the ML Module System
Recommendations
Mixin' up the ML module system
ICFP '08: Proceedings of the 13th ACM SIGPLAN international conference on Functional programmingML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules ...
Mixin' up the ML module system
ICFP '08ML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules ...
Type inference, principal typings, and let-polymorphism for first-class mixin modules
Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingA mixin module is a programming abstraction that simultaneously generalizes λ-abstractions, records, and mutually recursive definitions. Although various mixin module type systems have been developed, no one has investigated principal typings or ...
Comments