skip to main content
research-article
Open Access

Mixin’ Up the ML Module System

Published:01 April 2013Publication History
Skip Abstract Section

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.

References

  1. Abadi, M. and Cardelli, L. 1996. A Theory of Objects. Springer, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. Ancona, D. and Zucca, E. 1998. A theory of mixin modules: Basic and derived operators. Math. Struct. Comput. Sci. 8, 4, 401--446. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Ancona, D. and Zucca, E. 2002. A calculus of module systems. J. Funct. Program. 12, 2, 91--132. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. Bracha, G. and Lindstrom, G. 1992. Modularity meets inheritance. In Proceedings of the International Conference on Computer Languages (ICCL’92). IEEE.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. Dreyer, D. 2005. Understanding and evolving the ML module system. Ph.D. thesis, Carnegie Mellon University, Pittsburgh, PA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Dreyer, D. 2007a. Recursive type generativity. J. Funct. Program. 17, 4--5, 433--471. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. Duggan, D. 2002. Type-safe linking with recursive DLLs and shared libraries. ACM Trans. Program. Lang. Syst. 24, 6, 711--804. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Duggan, D. and Sourelis, C. 1996. Mixin modules. In Proceedings of the International Conference on Functional Programming (ICFP’96). ACM Press, New York. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. Harper, R. 2011. Programming in Standard ML. Working draft, Carnegie Mellon University, Pittsburgh, PA.Google ScholarGoogle Scholar
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. Harper, R. and Mitchell, J. C. 1993. On the type structure of Standard ML. ACM Trans. Program. Lang. Syst. 15, 2, 211--252. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle Scholar
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. Hirschowitz, T. and Leroy, X. 2005. Mixin modules in a call-by-value setting. ACM Trans. Program. Lang. Syst. 27, 5, 857--881. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  34. Leroy, X. 2000. A modular module system. J. Funct. Program. 10, 3, 269--303. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Leroy, X. 2003. A proposal for recursive modules in Objective Caml. http://caml.inria.fr/pub/papers/xleroy-recursive_modules-03.pdf.Google ScholarGoogle Scholar
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. Milner, R., Tofte, M., Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (revised). MIT Press, Cambridge, MA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  40. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. Neis, G., Dreyer, D., and Rossberg, A. 2011. Non-parametric parametricity. J. Funct. Program. 21, 4--5, 497--562. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  44. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  45. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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 ScholarGoogle Scholar
  47. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  48. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  49. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  50. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  51. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  52. Rossberg, A. and Dreyer, D. 2008. MixML (project website). http://www.mpi-sws.mpg.de/~rossberg/mixml/.Google ScholarGoogle Scholar
  53. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  54. Russo, C. V. 1998. Types for modules. Ph.D. thesis, University of Edinburgh.Google ScholarGoogle Scholar
  55. 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 ScholarGoogle Scholar
  56. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  57. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  58. Stone, C. A. and Harper, R. 2006. Extensional equivalence and singleton types. ACM Trans. Comput. Logic 7, 4, 676--722. Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. Wadler, P. 1990. Linear types can change the world! In Programming Concepts and Methods, M. Broy and C. Jones Eds., North Holland.Google ScholarGoogle Scholar
  60. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  61. Walker, D. 2005. Substructural type systems. In Advanced Topics in Types and Programming Languages, B. C. Pierce Ed., MIT Press, Cambridge, MA.Google ScholarGoogle Scholar

Index Terms

  1. Mixin’ Up the ML Module System

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM Transactions on Programming Languages and Systems
                ACM Transactions on Programming Languages and Systems  Volume 35, Issue 1
                April 2013
                240 pages
                ISSN:0164-0925
                EISSN:1558-4593
                DOI:10.1145/2450136
                Issue’s Table of Contents

                Copyright © 2013 ACM

                Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 1 April 2013
                • Accepted: 1 August 2012
                • Revised: 1 April 2012
                • Received: 1 September 2011
                Published in toplas Volume 35, Issue 1

                Permissions

                Request permissions about this article.

                Request Permissions

                Check for updates

                Qualifiers

                • research-article
                • Research
                • Refereed

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader