Hygienic macros, as described in [2][3], are implemented. Structures may export macros; auxiliary names introduced into the expansion are resolved in the environment of the macro's definition.
For example, the scheme structure's delay macro is defined by the rewrite rule
The variable make-promise is defined in the scheme structure's underlying package, but is not exported. A use of the delay macro, however, always accesses the correct definition of make-promise. Similarly, the case macro expands into uses of cond, eqv?, and so on. These names are exported by scheme, but their correct bindings will be found even if they are shadowed by definitions in the client package.(delayexp
)--->
(make-promise (lambda ()exp
)).
Previous: Interfaces | Next: Higher-order modules