skip to main content
10.1145/944705.944729acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

FreshML: programming with binders made simple

Published: 25 August 2003 Publication History

Abstract

FreshML extends ML with elegant and practical constructs for declaring and manipulating syntactical data involving statically scoped binding operations. User-declared FreshML datatypes involving binders are concrete, in the sense that values of these types can be deconstructed by matching against patterns naming bound variables explicitly. This may have the computational effect of swapping bound names with freshly generated ones; previous work on FreshML used a complicated static type system inferring information about the 'freshness' of names for expressions in order to tame this effect. The main contribution of this paper is to show (perhaps surprisingly) that a standard type system without freshness inference, coupled with a conventional treatment of fresh name generation, suffices for FreshML's crucial correctness property that values of datatypes involving binders are operationally equivalent if and only if they represent a-equivalent pieces of object-level syntax. This is established via a novel denotational semantics. FreshML without static freshness inference is no more impure than ML and experience with it shows that it supports a programming style pleasingly close to informal practice when it comes to dealing with object-level syntax modulo a-equivalence.

References

[1]
S. Abramsky and A. Jung. Domain theory. In S. Abramsky, D. M. Gabbay, and T. S. E. Maibaum, editors, Handbook of Logic in Computer Science, Volume 3. Semantic Structures, chapter 1. Oxford University Press, 1994.]]
[2]
M. S. Ager, D. Biernacki, O. Danvy, and J. Midtgaard. From interpreter to compiler and virtual machine: A functional derivation. Technical Report BRICS RS-03-14, BRICS, Department of Computer Science, University of Aarhus, March 2003.]]
[3]
H. P. Barendregt. The Lambda Calculus: Its Syntax and Semantics. North-Holland, revised edition, 1984.]]
[4]
G. Barthe. Type-checking injective pure type systems. Journal of Functional Programming, 9(6):675--698, 1999.]]
[5]
L. Caires and L. Cardelli. A spatial logic for concurrency (part II). In CONCUR 2002 -- Concurrency Theory, 13th International Conference, Brno, Czech Republic, August 20-23, 2002. Proceedings, volume 2421 of Lecture Notes in Computer Science, pages 209--225. Springer-Verlag, Berlin, 2002.]]
[6]
L. Cardelli, P. Gardner, and G. Ghelli. Manipulating trees with hidden labels. In Foundations of Software Science and Computation Structures, 6th International Conference, FOSSACS 2003, Warsaw, Poland. Proceedings, volume 2620 of Lecture Notes in Computer Science, pages 216--232. Springer-Verlag, Berlin, 2003.]]
[7]
K. Claessen and D. Sands. Observable sharing for functional circuit description. In Advances in Computing Science ASIAN'99, 5th Asian Computing Science Conference, volume 1742 of Lecture Notes in Computer Science, pages 62--73. Springer-Verlag, 1999.]]
[8]
N. G. de Bruijn. Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indag. Math., 34:381--392, 1972.]]
[9]
M. P. Fiore, E. Moggi, and D. Sangiorgi. A fully abstract model for the p-calculus (extended abstract). In Eleventh Annual Symposium on Logic in Computer Science, pages 43--54. IEEE Computer Society Press, Washington, 1996.]]
[10]
M. J. Gabbay. A Theory of Inductive Definitions with a-Equivalence: Semantics, Implementation, Programming Language. PhD thesis, University of Cambridge, 2000.]]
[11]
M. J. Gabbay. The p-calculus in FM. Submitted, September 2002.]]
[12]
M. J. Gabbay. FM for process calculi that generate fresh names. Submitted, June 2003.]]
[13]
M. J. Gabbay and A. M. Pitts. A new approach to abstract syntax with variable binding. Formal Aspects of Computing, 13:341--363, 2002.]]
[14]
F. Honsell, M. Miculan, and I. Scagnetto. An axiomatic approach to metareasoning on nominal algebras in HOAS. In 28th International Colloquium on Automata, Languages and Programming, ICALP 2001, Crete, Greece, July 2001. Proceedings, volume 2076 of Lecture Notes in Computer Science, pages 963--978. Springer-Verlag, Heidelberg, 2001.]]
[15]
R. Laemmel and S. L. Peyton Jones. Scrap your boilerplate: A practical approach to generic programming. In ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI 2003), New Orleans, pages 26--37. ACM Press, 2003.]]
[16]
D. A. Miller. An extension to ML to handle bound variables in data structures: Preliminary report. In Proceedings of the Logical Frameworks BRA Workshop, 1990.]]
[17]
R. Milner, J. Parrow, and D. Walker. A calculus of mobile processes (parts I and II). Information and Computation, 100:1--77, 1992.]]
[18]
R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.]]
[19]
E. Moggi. Notions of computation and monads. Information and Computation, 93(1):55--92, 1991.]]
[20]
A. Nanevski. Meta-programming with names and necessity. In Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, ICFP 2002, Pittsburgh, Pennsylvania, pages 206--217. ACM Press, New York, 2002.]]
[21]
M. Odersky. A functional theory of local names. In Conference Record of the 21st Annual ACM Symposium on Principles of Programming Languages, pages 48--59. ACM Press, 1994.]]
[22]
F. Pfenning and C. Elliott. Higher-order abstract syntax. In Proc. ACM-SIGPLAN Conference on Programming Language Design and Implementation, pages 199--208. ACM Press, 1988.]]
[23]
A. M. Pitts. Relational properties of domains. Information and Computation, 127:66--90, 1996.]]
[24]
A. M. Pitts. Nominal logic, a first order theory of names and binding. Information and Computation, to appear. (A preliminary version appeared in the Proceedings of the 4th International Symposium on Theoretical Aspects of Computer Software (TACS 2001), LNCS~2215, Springer-Verlag, 2001, pp~219--242.).]]
[25]
A. M. Pitts and M. J. Gabbay. A metalanguage for programming with bound names modulo renaming. In Mathematics of Program Construction. 5th International Conference, MPC2000, Ponte de Lima, Portugal, July 2000. Proceedings, volume 1837 of Lecture Notes in Computer Science, pages 230--255. Springer-Verlag, Heidelberg, 2000.]]
[26]
A. M. Pitts and I. D. B. Stark. Observable properties of higher order functions that dynamically create local names, or: What's new? In Mathematical Foundations of Computer Science, Proc. 18th Int. Symp., GdaNsk, 1993, volume 711 of Lecture Notes in Computer Science, pages 122--141. Springer-Verlag, Berlin, 1993.]]
[27]
T. Sheard. Accomplishments and research challenges in meta-programming. In Semantics, Applications, and Implementation of Program Generation, Second International Workshop, SAIG 2001, Florence, Italy, September 6, 2001, Proceedings., volume 2196 of Lecture Notes in Computer Science, pages 2--44. Springer, 2001.]]
[28]
M. R. Shinwell. Swapping the atom: Programming with binders in Fresh O'Caml. Submitted, June 2003.]]
[29]
M. R. Shinwell and A. M. Pitts. FreshML User Manual. Cambridge University Computer Laboratory, November 2002. Available at http://www.freshml.org/docs/.]]
[30]
I. D. B. Stark. Categorical models for local names. Lisp and Symbolic Computation, 9(1):77--107, 1996.]]
[31]
I. D. B. Stark. A fully abstract domain model for the p-calculus. In 11th Annual Symposium on Logic in Computer Science, pages 36--42. IEEE Computer Society Press, Washington, 1996.]]
[32]
C. Urban, A. M. Pitts, and M. J. Gabbay. Nominal unification. In Computer Science Logic and 8th Kurt Gödel Colloquium (CSL'03 & KGC), Vienna, Austria. Proccedings, Lecture Notes in Computer Science. Springer-Verlag, Berlin, 2003.]]

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '03: Proceedings of the eighth ACM SIGPLAN international conference on Functional programming
August 2003
310 pages
ISBN:1581137567
DOI:10.1145/944705
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 38, Issue 9
    September 2003
    289 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/944746
    Issue’s Table of Contents
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 August 2003

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. alpha-conversion
  2. metaprogramming
  3. variable binding

Qualifiers

  • Article

Conference

ICFP03
Sponsor:

Acceptance Rates

ICFP '03 Paper Acceptance Rate 24 of 95 submissions, 25%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)1
Reflects downloads up to 06 Jan 2025

Other Metrics

Citations

Cited By

View all

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