skip to main content
research-article

Recursive structures for standard ML

Published: 18 March 2012 Publication History

Abstract

Standard ML is a statically typed programming language that is suited for the construction of both small and large programs. "Programming in the small" is captured by Standard ML's Core language. "Programming in the large" is captured by Standard ML's Modules language that provides constructs for organising related Core language definitions into self-contained modules with descriptive interfaces. While the Core is used to express details of algorithms and data structures, Modules is used to express the overall architecture of a software system. In Standard ML, modular programs must have a strictly hierarchical structure: the dependency between modules can never be cyclic. In particular, definitions of mutually recursive Core types and values, that arise frequently in practice, can never span module boundaries. This limitation compromises modular programming, forcing the programmer to merge conceptually (i.e. architecturally) distinct modules. We propose a practical and simple extension of the Modules language that caters for cyclic dependencies between both types and terms defined in separate modules. Our design leverages existing features of the language, supports separate compilation of mutually recursive modules and is easy to implement.

References

[1]
Ancona, D., and Zucca, E. 1999. A primitive calculus of mixin modules. In Proc. Principles and Practice of Declarative Programming, LNCS vol. 1702, pages 69--72, Berlin.
[2]
Crary, K., and Harper, R., and Puri, S. 1999. What is a recursive module? In Proc. ACM SIGPLAN'99 Conf. on Programming Language Design and Implementation, pages 50--63.
[3]
Dreyer, D., and Harper, R., and Crary, K. 2001. Toward a Practical Type Theory for Recursive Modules. TR CMU-CS-01-112, Computer Science, Carnegie-Mellon University, March.
[4]
Duggan, D., and Sourelis, C. 1996. Mixin modules. In Proc. ACM SIGPLAN International Conference on Functional Programming, pages 262--273, Philadelphia.
[5]
Duggan, D., and Sourelis, C. 1998. Parameterized modules, recursive modules, and mixin modules. In Proc. ACM SIGPLAN Workshop on ML, pages 87--96, Baltimore.
[6]
Elsman, M. 1999. Program Modules, Separate Compilation, and Intermodule Optimisation. PhD thesis. University of Copenhagen.
[7]
Flatt, M., and Felleisen, M. 1998. Units: cool modules for HOT languages. In Proc. ACM SIGPLAN'98 Conf. on Programming Language Design and Implementation, pages 236--248.
[8]
Harper, R., Lillibridge, M. 1994. A type-theoretic approach to higher-order modules with sharing. In 21st ACM Symp. Principles of Programming Languages.
[9]
Harper, R, and Mitchell, J. C., and Moggi, E. 1990. Higher-order modules and the phase distinction. In 17th ACM Symp. Principles of Programming Languages.
[10]
Leroy, X., 1994. Manifest types, modules, and separate compilation. In 21st ACM Symp. Principles of Programming Languages, pages 109--122. ACM Press.
[11]
Leroy, X., 1995. Applicative functors and fully transparent higher-order modules. In 22nd ACM Symp. Principles of Programming Languages.ACM Press.
[12]
Milner, R., and Tofte, M., and Harper, R., and MacQueen, D. 1997. The Definition of Standard ML (Revised). MIT Press.
[13]
Okasaki, C. 1998. Purely Functional Data Structures. Cambridge University Press.
[14]
Russo, C. V. 1998. Types For Modules. PhD Thesis, LFCS, University of Edinburgh.
[15]
Russo, C. V. 1999. Non-Dependent Types For Standard ML Modules. In 1999 Int'l Conf. on Principles and Practice of Declarative Programming.
[16]
Russo, C. V. 2000. First-Class Structures for Standard ML. In Nordic Journal of Computing, 7(4):348, Winter 2000.
[17]
Sestoft, P., and Romanenko, S., and Russo, C. V. 2000. MoscowML V2.00.
[18]
Tofte, M. 1988. Operational Semantics and Polymorphic Type Inference. PhD thesis, Computer Science, University of Edinburgh.
[19]
Wells, M., and Vestergaard, R. 2000. Equational reasoning for linking with first-class primitive modules. In Programming Languages & Systems, 9th European Symp. Programming, LNCS vol. 1782, pages 412--428, Berlin.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 47, Issue 4a
Supplemental issue
April 2012
85 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/2442776
Issue’s Table of Contents

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 18 March 2012
Published in SIGPLAN Volume 47, Issue 4a

Check for updates

Author Tags

  1. datatypes
  2. recursive modules
  3. standard ML
  4. type theory

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 51
    Total Downloads
  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 14 Feb 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media