Skip to main content

Modules, Macros and Lisp

  • Chapter
Book cover Computer Science

Abstract

Many modern languages offer a concept of modules to encapsulate a set of definitions and make some of them visible from outside. Associated to modules are directives ruling importations and exportations as well as controlling other capabilities like renaming or qualified notation. We propose here a language to handle sets of named locations with the aim of describing precisely which locations are to be shared between modules and under which local names they are known. The language is symmetric for imports and exports. It is also extensible since it provides a framework to handle named locations. Mutability, for instance, can readily be expressed thanks to a simple extension of our language.

Another more subtle extension is to offer a protocol for modules with “macros.” Macros allow a user to extend the syntax of a language by providing rewriting rules expressed as computations performed on the representation of programs. Lisp is a language offering macros and much of its extensibility stems from them. However, many problems arise from macros, amongst them being the exact definition of when, where and how the macroexpansion is done to turn the body of a module using extended syntaxes into a regular form in the bare, unextended language.

This paper presents, in the framework of Lisp, a definition of modules offering tight control over module environments as well as a precise semantics of separate compilation and macroexpansion. These new (for Lisp) capabilities definitely add some power relative to the management of name spaces but also justify compiling optimizations (inlining, partial evaluation etc.) and, above all, turn Lisp into a language suitable for application delivery since applications are finite collections of modules. Our proposal contributes to a vision of Lisp composed of a multitude of linked and reusable modules. Our results concerning name space management and macros can also be applied to other languages.

Two different implementations of these concepts exist: in FEEL, the implementation of EuLisp done by the University of Bath and in the idiom of Icsla, a dialect of Lisp designed at INRIA-Rocquencourt and École Polytechnique. This paper reflects the results of the experiments carried out in these systems during the last year.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Bibliography

  1. William Clinger, Jonathan Rees, Macros That Work, Eighteenth Annual ACM Symposium on Principles of Programming Languages, Orlando, Florida, January 1991, pp 155–162.

    Google Scholar 

  2. Pavel Curtis, James Rauon, A Module System for Scheme, 1990 ACM Conference on Lisp and Functional Programming, Nice, Prance, June 1990, pp 13–19.

    Google Scholar 

  3. [Dybvig et al, 1988]_R. Kent Dybvig, Daniel P. Friedman, Christopher T. Haynes, Expansion-Passing-Style: A General Macro Mechanism, Lisp and Symbolic Computation, Vol. 1, No. 1, June 1988, pp 53–76.

    Article  Google Scholar 

  4. [Kohlbecker et al, 1986]_Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, Bruce Duba, Hygienic Macro Expansion, Proceedings of 1986 ACM Conference on Lisp and Functional Programming, pp 151–161, ACM Press, New York, 1986.

    Chapter  Google Scholar 

  5. Matthews D.C.J, Programming Language Design with Polymorphism, University of Cambridge Computer Laboratory’ Technical Report. No. 49, 1983.

    Google Scholar 

  6. Christian Queinuec, Julian Padget, A Model of Modules and Macros for Lisp, Bath Computing Group Technical Report 90-36, University of Bath, UK.

    Google Scholar 

  7. Christian Queinnec, Compilation of Non-Linear, Second Order Patterns on S-Expressions, International Workshop PULP’ 90, Linköping, Sweden, August 1990, Lecture Notes in Computer Science 456, Springer-Verlag, pp 340–357.

    Google Scholar 

  8. Jonathan A. Rees, William dinger, Revised3 Report on the Algorithmic Language Scheme, ACM SIGPLAN Notices. 21, 12, Dec 86, pp 37–79, ACM Press, New York, 1986.

    Google Scholar 

  9. Steele G.L. Jr., Common Lisp the language, Second Edition, Digital Press, 1990.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer Science+Business Media New York

About this chapter

Cite this chapter

Queinnec, C., Padget, J. (1992). Modules, Macros and Lisp. In: Baeza-Yates, R., Manber, U. (eds) Computer Science. Springer, Boston, MA. https://doi.org/10.1007/978-1-4615-3422-8_10

Download citation

  • DOI: https://doi.org/10.1007/978-1-4615-3422-8_10

  • Publisher Name: Springer, Boston, MA

  • Print ISBN: 978-1-4613-6513-6

  • Online ISBN: 978-1-4615-3422-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics