We can imagine two versions of local-expand.
local-expand-syntax executes at phase 1, takes a Syntax object and expands it at phase 0, producing a Syntax object. Syntax objects can be deconstructed with open-syntax, spliced into larger Syntax objects with close-syntax, and eventually returned by the macro.
local-expand-core executes at phase 1, takes a Syntax object and expands it at phase 0, producing an opaque value of type Core. Values of type Core can be deconstructed carefully, producing well-formed Core sub-terms, they can be embedded into larger Syntax objects, and eventually returned by the macro.
One disadvantage of local-expand-syntax is that once the Syntax it returns is returned by the macro, the expander needs to expand it again, even though it is known to already contain only core constructs. This can lead to quadratic performance in some cases, and for this reason, we have long wanted Klister to have local-expand-core.
We can imagine two versions of
local-expand.local-expand-syntaxexecutes at phase 1, takes a Syntax object and expands it at phase 0, producing a Syntax object. Syntax objects can be deconstructed withopen-syntax, spliced into larger Syntax objects withclose-syntax, and eventually returned by the macro.local-expand-coreexecutes at phase 1, takes a Syntax object and expands it at phase 0, producing an opaque value of typeCore. Values of typeCorecan be deconstructed carefully, producing well-formedCoresub-terms, they can be embedded into larger Syntax objects, and eventually returned by the macro.One disadvantage of
local-expand-syntaxis that once theSyntaxit returns is returned by the macro, the expander needs to expand it again, even though it is known to already contain only core constructs. This can lead to quadratic performance in some cases, and for this reason, we have long wanted Klister to havelocal-expand-core.