[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
article

Recursive type generativity

Published: 12 September 2005 Publication History

Abstract

Existential types provide a simple and elegant foundation for understanding generative abstract data types, of the kind supported by the Standard ML module system. However, in attempting to extend ML with support for recursive modules, we have found that the traditional existential account of type generativity does not work well in the presence of mutually recursive module definitions. The key problem is that, in recursive modules, one may wish to define an abstract type in a context where a name for the type already exists, but the existential type mechanism does not allow one to do so.We propose a novel account of recursive type generativity that resolves this problem. The basic idea is to separate the act of generating a name for an abstract type from the act of defining its underlying representation. To define several abstract types recursively, one may first "forward-declare" them by generating their names, and then define each one secretly within its own defining expression. Intuitively, this can be viewed as a kind of backpatching semantics for recursion at the level of types. Care must be taken to ensure that a type name is not defined more than once, and that cycles do not arise among "transparent" type definitions.In contrast to the usual continuation-passing interpretation of existential types in terms of universal types, our account of type generativity suggests a destination-passing interpretation. Briefly, instead of viewing a value of existential type as something that creates a new abstract type every time it is unpacked, we view it as a function that takes as input a pre-existing undefined abstract type and defines it. By leaving the creation of the abstract type name up to the client of the existential, our approach makes it significantly easier to link abstract data types together recursively.

References

[1]
Roberto Amadio and Luca Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, 1993.
[2]
Davide Ancona and Elena Zucca. A primitive calculus for module systems. In International Conference on Principles and Practice of Declarative Programming (PPDP), volume 1702 of Lecture Notes in Computer Science, pages 62--79. Springer-Verlag, 1999.
[3]
Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In ACM Conference on Programming Language Design and Implementation (PLDI), pages 50--63, Atlanta, GA, 1999.
[4]
Derek Dreyer. A type system for well-founded recursion. In ACM Symposium on Principles of Programming Languages (POPL), pages 293--305, Venice, Italy, January 2004.
[5]
Derek Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, May 2005.
[6]
Derek Dreyer, Karl Crary, and Robert Harper. A type system for higher-order modules. In ACM Symposium on Principles of Programming Languages (POPL), New Orleans, LA, January 2003.
[7]
Dominic Duggan. Type-safe linking with recursive DLL's and shared libraries. ACM Transactions on Programming Languages and Systems, 24(6):711--804, November 2002.
[8]
Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 236--248, Montreal, Canada, June 1998.
[9]
David K. Gifford and John M. Lucassen. Integrating functional and imperative programming. In ACM Conference on LISP and Functional Programming, Cambridge, MA, August 1986.
[10]
Mark P. Jones. Using parameterized signatures to express modular structure. In ACM Symposium on Principles of Programming Languages (POPL), pages 68--78, St. Petersburg Beach, FL, 1996.
[11]
Xavier Leroy. The Objective Caml system: Documentation and user's manual. http://www.ocaml.org/.
[12]
Xavier Leroy. Applicative functors and fully transparent higherorder modules. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 142--153, San Francisco, CA, January 1995.
[13]
Xavier Leroy. A proposal for recursive modules in Objective Caml, May 2003. Available from the author's website.
[14]
Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.
[15]
Moscow ML. www.dina.kvl.dk/~sestoft/mosml.html.
[16]
MzScheme. www.plt-scheme.org/software/mzscheme/.
[17]
Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998.
[18]
Andreas Rossberg. Generativity and dynamic opacity for abstract types. In International Conference on Principles and Practice of Declarative Programming (PPDP), Uppsala, Sweden, 2003.
[19]
Claudio V. Russo. Recursive structures for Standard ML. In International Conference on Functional Programming (ICFP), pages 50--61, Florence, Italy, September 2001.
[20]
Christopher A. Stone. Type definitions. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 9. MIT Press, 2005.
[21]
Christopher A. Stone and Robert Harper. Extensional equivalence and singleton types. ACM Transactions on Computational Logic, 2005. To appear.
[22]
Jean-Pierre Talpin and Pierre Jouvelot. The type and effect discipline. Information and Computation, 111(2):245--296, 1994.
[23]
Joseph C. Vanderwaart, Derek Dreyer, Leaf Petersen, Karl Crary, Robert Harper, and Perry Cheng. Typed compilation of recursive datatypes. In ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI), New Orleans, January 2003.
[24]
Philip Wadler. Listlessness is Better than Laziness. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, August 1985.

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 40, Issue 9
Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
September 2005
330 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1090189
Issue’s Table of Contents
  • cover image ACM Conferences
    ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
    September 2005
    342 pages
    ISBN:1595930647
    DOI:10.1145/1086365
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: 12 September 2005
Published in SIGPLAN Volume 40, Issue 9

Check for updates

Author Tags

  1. abstract data types
  2. effect systems
  3. generativity
  4. recursion
  5. recursive modules
  6. type systems

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media