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.
KeywordsProper Part Module Environment Module Body Qualified Notation Partial Evaluator
Unable to display preview. Download preview PDF.
- [Clinger & Rees, 1991]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
- [Curtis & Rauen, 1990]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
- [Matthews, 1983]Matthews D.C.J, Programming Language Design with Polymorphism, University of Cambridge Computer Laboratory’ Technical Report. No. 49, 1983.Google Scholar
- [Queinnec & Padget, 1990]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
- [Queinnec, 1990]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
- [Rees & Clinger 1986]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
- [Steele, 1990]Steele G.L. Jr., Common Lisp the language, Second Edition, Digital Press, 1990.Google Scholar