2 ms·
I was talking about macro-expanding the form first so that the result to be walked consists of only "core" lisp forms. Do you mean that there are macro-expande
by pflanze 8y ago
I was talking about macro-expanding the form first so that the result to be walked consists of only "core" lisp forms.
Do you mean that there are macro-expander APIs in CL that offer all ingredients to do the derivation as part of the macro-expansion step? (I'd welcome some pointer to study.)
- kazinator 8y agoThe macro expander is a code walker. Whenever it encounters a macro, it expands it (repeatedly, if necessary). Then when all that is left is a special form or function call, or when such a thing is encountered in the first place, it walks that form in the manner appropriate to that form. So by the time macros are expanded, a code walk has taken place over all the special forms and function calls that have emerged. CL doesn't standardize any API for doing anything with the &environment parameter, other than using it as an argument in macroexpand and macroexpand-1, which is a pity. There is information in there such as "is this symbol a lexical variable in this macro's scope". Steele's Cltl2 describes such features, but these didn't make it into ANSI CL. It describes accessors variable-information, function-information and declaration-information. Also an augment-environment function and some other things like enclose.