Composable and compilable macros:: you want it when?

Composable and compilable macros:: you want it when?
复制标题

可组合和可编译宏:: 你什么时候想要它?

DOI:
--
复制
发表时间:
2002
期刊:
ACM SIGPLAN International Conference on Functional Programming
影响因子:
--
通讯作者:
M. Flatt
M. Flatt
中科院分区:
--
文献类型:
--
作者:
M. Flatt

文献摘要

被引文献

相似文献

许多宏系统,特别是Lisp和Scheme,允许宏转换器执行一般计算。此外,实现编译时宏转换器的语言通常与实现运行时函数的语言相同。作为这种共享的副作用,实现往往允许混合编译时值和运行时值,以及来自单独编译的值。这样的混合破坏了必须解析代码而不执行代码的编程工具。宏实现器通过遵守某些宏定义协议和在代码中插入相位区分注释来避免有害的混合。然而,注释是脆弱的,协议没有被强制执行,程序员只能根据编译器的实现来推断结果。MzScheme--PLT Scheme工具套件的语言--通过宏系统解决了这个问题,该系统在不牺牲宏的表达能力的情况下分离了编译。
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.