As an after-thought,
Sam's example leads us to categorize a second family of sources of binding polymorphism. We now have that binding polymorphism is a result of:
- Higher-order macros, where an operator can be passed to a macro that is either an ordinary expression or a macro keyword, and when the macro generates code that applies the operator, it may or may not bind identifiers in other subexpressions.
- Local expansion contexts, where a macro may force the expansion of a particular subexpression (via, e.g., local-expand) to allow new macros to extend the behavior of the macro, potentially binding identifiers in different ways.
Although
lazy macro expansion is important and powerful, it turns out that being able to force eager expansion is important, too. It allows programmers to specify new kinds of expansion contexts to allow points of extensions within a macro. When macros become sufficiently large, the need to extend them with new subforms is inevitable. Examples in mzscheme where this either exists, desparately needs to exist, or will soon exist:
- the class macro
- the require and provide macros
- the match library
No comments:
Post a Comment