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

Composable and compilable macros:: you want it when?

Published:17 September 2002Publication History

ABSTRACT

Many macro systems, especially for Lisp and Scheme, allow macro transformers to perform general computation. Moreover, the language for implementing compile-time macro transformers is usually the same as the language for implementing run-time functions. As a side effect of this sharing, implementations tend to allow the mingling of compile-time values and run-time values, as well as values from separate compilations. Such mingling breaks programming tools that must parse code without executing it. Macro implementors avoid harmful mingling by obeying certain macro-definition protocols and by inserting phase-distinguishing annotations into the code. However, the annotations are fragile, the protocols are not enforced, and programmers can only reason about the result in terms of the compiler's implementation. MzScheme---the language of the PLT Scheme tool suite---addresses the problem through a macro system that separates compilation without sacrificing the expressiveness of macros.

References

  1. J. Baker and W. C. Hsieh. Maya: Multiple-dispatch syntax extension in Java. In Proc. ACM Conference on Programming Language Design and Implementation, pages 270--281, June 2002.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Bawden and J. Rees. Syntactic closures. In Proc. ACM Conference on Lisp and Functional Programming, pages 86--95, July 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. H. Bromley. Lisp Lore: A Guide to Programming the Lisp Machine. Kluwer Academic Publishers, 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. W. Clinger and J. Rees. Macros that work. In Proc. ACM Symposium on Principles of Programming Languages, pages 155--162, Jan. 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Curtis and J. Rauen. A module system for Scheme. In Proc. ACM Conference on Lisp and Functional Programming, pages 13--28, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. R. Davies and F. Pfenning. A modal analysis of staged computation. In Proc. ACM Symposium on Principles of Programming Languages, pages 258--270, Jan. 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. R. K. Dybvig. Chez Scheme User's Guide. Cadence Research Systems, 1998.]]Google ScholarGoogle Scholar
  8. R. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5(4):295--326, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. Flatt and M. Felleisen. Units: Cool modules for HOT languages. In Proc. ACM Conference on Programming Language Design and Implementation, pages 236--248, June 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. D. P. Friedman, M. Wand, and C. P. Haynes. Essentials of Programming Languages. The MIT Press, Cambridge, Massachusetts, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. Ganz, A. Sabry, and W. Taha. Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML. In Proc. ACM International Conference on Functional Programming, pages 74--85, Sept. 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. T. P. Hart and T. G. Evans. Notes on implementing lisp for the m-460 computer. In E. C. Berkeley and D. G. Bowbrow, editors, The Programming language LISP: Its Operation and Applications, pages 191--203. MIT Press, 1964.]]Google ScholarGoogle Scholar
  13. R. Kelsey. SRFI 19: Defining record types, 1999. http://srfi.schemers.org/srfi-9/.]]Google ScholarGoogle Scholar
  14. R. Kelsey, W. Clinger, and J. Rees (Eds.). The revised5 report on the algorithmic language Scheme. ACM SIGPLAN Notices, 33(9), Sept. 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. E. Kohlbecker, D. P. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In Proc. ACM Conference on Lisp and Functional Programming, pages 151--181, Aug. 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. E. Moggi, W. Taha, Z. El-Abidine Benaissa, and T. Sheard. An idealized MetaML: Simpler, and more expressive. In Proc. European Symposium on Programming, volume 1576 of Lecture Notes in Computer Science, pages 193--207. Springer-Verlag, Apr. 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. D. A. Moon. MACLISP Reference Manual. MIT Press, 1974.]]Google ScholarGoogle Scholar
  18. M. Poletto, W. C. Hsieh, D. R. Engler, and M. F. Kaashoek. 'C and tcc: a language and compiler for dynamic code generation. ACM Transactions on Computing Systems, 21(2):324--369, Mar. 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. Queinnec. Macroexpansion reflective tower. In Proc. Reflections Conference, pages 93--194, Apr. 1996.]]Google ScholarGoogle Scholar
  20. J. Rees. Another module system for Scheme, 1994. Scheme48 documentation.]]Google ScholarGoogle Scholar
  21. M. Serrano. Bigloo: A "practical Scheme compiler", 2002.]]Google ScholarGoogle Scholar
  22. A. Shalit. The Dylan Reference Manual. Addison-Wesley, 1996.]]Google ScholarGoogle Scholar
  23. G. L. Steele Jr. Common Lisp: The Language. Digital Press, second edition, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. G. L. Steele, Jr. and G. J. Sussman. The revised report on SCHEME: A dialect of LISP. Technical Report 452, MIT, Jan. 1978.]]Google ScholarGoogle Scholar
  25. O. Waddell and R. K. Dybvig. Extending the scope of syntactic abstraction. In Proc. ACM Symposium on Principles of Programming Languages, pages 203--213, Jan. 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Weise and R. F. Crew. Programmable syntax macros. In Proc. ACM Conference on Programming Language Design and Implementation, pages 156--165, June 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. A. K. Wright. Pattern Matching for Scheme, Mar. 1996.]]Google ScholarGoogle Scholar

Index Terms

  1. Composable and compilable macros:: you want it when?

          Recommendations

          Comments

          Login options

          Check if you have access through your login credentials or your institution to get full access on this article.

          Sign in
          • Published in

            cover image ACM Conferences
            ICFP '02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming
            October 2002
            294 pages
            ISBN:1581134878
            DOI:10.1145/581478
            • cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 37, Issue 9
              September 2002
              283 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/583852
              Issue’s Table of Contents

            Copyright © 2002 ACM

            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: 17 September 2002

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            ICFP '02 Paper Acceptance Rate24of76submissions,32%Overall Acceptance Rate333of1,064submissions,31%

            Upcoming Conference

            ICFP '24

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader