hh.sePublications
Change search
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf
Macros as Multi-Stage Computations: Type-Safe, Generative, Binding Macros in MacroML
Computer Science Department, Indiana University, Bloomington, Indiana, United States.
Computer Science Department, Indiana University, Bloomington, Indiana, United States.
Department of Computer Science, Yale University, New Haven, United States.
2001 (English)In: Proceedings of the Sixth ACM SIGPLAN International Conference on Functional Programming (ICFP'01): Florence, Italy, Sept. 3-5, 2001, New York, N.Y.: ACM Press, 2001, 74-85 p.Conference paper, Published paper (Refereed)
Abstract [en]

With few exceptions, macros have traditionally been viewed as operations on syntax trees or even on plain strings. This view makes macros seem ad hoc, and is at odds with two desirable features of contemporary typed functional languages: static typing and static scoping. At a deeper level, there is a need for a simple, usable semantics for macros. This paper argues that these problems can be addressed by formally viewing macros as multi-stage computations. This view eliminates the need for freshness conditions and tests on variable names, and provides a compositional interpretation that can serve as a basis for designing a sound type system for languages supporting macros, or even for compilation. To illustrate our approach, we develop and present MacroML, an extension of ML that supports inlining, recursive macros, and the definition of new binding constructs. The latter is subtle, and is the most novel addition in a statically typed setting. The semantics of a core subset of MacroML is given by an interpretation into MetaML, a statically-typed multi-stage programming language. It is then easy to show that MacroML is stage- and type-safe: macro expansion does not depend on runtime evaluation, and both stages do not "go wrong.

Place, publisher, year, edition, pages
New York, N.Y.: ACM Press, 2001. 74-85 p.
National Category
Computer Systems
Identifiers
URN: urn:nbn:se:hh:diva-20987DOI: 10.1145/507669.507646ISI: 000172134900009Scopus ID: 2-s2.0-0034782593Libris ID: 12438527ISBN: 1-58113-415-0 OAI: oai:DiVA.org:hh-20987DiVA: diva2:588289
Conference
6th ACM SIGPLAN Internatinal Conference on Functional Programming (ICFP'01), Florence, Italy, 3-5 September, 2001
Note

This work was supported in part by the National Science Foundation under Grant # CCR-9987458.

This material is based upon work supported by the National Science Foundation under Grant # CCR-0196063.

W. Taha funded by subcontract #8911-48186 from Johns Hopkins University under NSF agreement Grant # EIA-9996430.

Available from: 2013-01-15 Created: 2013-01-14 Last updated: 2015-05-12Bibliographically approved

Open Access in DiVA

No full text

Other links

Publisher's full textScopus

Search in DiVA

By author/editor
Taha, Walid
Computer Systems

Search outside of DiVA

GoogleGoogle Scholar

Altmetric score

Total: 85 hits
CiteExportLink to record
Permanent link

Direct link
Cite
Citation style
  • apa
  • ieee
  • modern-language-association-8th-edition
  • vancouver
  • Other style
More styles
Language
  • de-DE
  • en-GB
  • en-US
  • fi-FI
  • nn-NO
  • nn-NB
  • sv-SE
  • Other locale
More languages
Output format
  • html
  • text
  • asciidoc
  • rtf