-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local-expand #247
Comments
I think it might make sense to have a variant of |
It seems unwise to expose Klister's definition of |
Here is a concrete use case. I would like to write a |
Actually, that sounds like a step towards #119? Instead of |
Let's think about the implementation of Given this, I can think of three approaches.
I like (3), even though it is the most complicated and it creates extra temporary mortisses. I like the fact that it separates user-defined macros from primitive macros, and that it does so by looking at whether the head is the name of a primitive macro or the name of a user-defined macro. It looks like the Syntax-headed regional macro approach I just described, and thus it seems plausible that it could be generalized to regions other than Core, or to datatype-headed regional macros! |
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 withopen-syntax
, spliced into larger Syntax objects withclose-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 typeCore
. Values of typeCore
can be deconstructed carefully, producing well-formedCore
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 theSyntax
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 havelocal-expand-core
.The text was updated successfully, but these errors were encountered: