To get rid of racket expressions that have been embedded in metafunctions and
reduction relations, you use `with-unquote-rewriter`, but you can currently
only have one rewriter active at a time (as underneath it's a single parameter
that holds a function).
I've been writing a little library to make working with rewriters a little more
friendly, I expose a rewriter stack that you can push and pop atomic and
compound rewriters to. I've been thinking about how best to add support for
unquote rewriters, but I'm stumped.
One possibility that occurred to me was to have pushing an unquote rewriter
procedure RW onto the stack just set the current unquote rewriter to a function
that calls RW on the lw in question, and if RW produces an lw where the unq?
field is true, then that is the result, otherwise use the previous unquote
rewriter (thus rewriters that don't want to make a change pass responsibility
up the stack). Other than the fact that this could get rather slow when the
unquote-rewriter stack gets really deep, redex currently doesn't publicly
export the current-unquote-rewriter parameter. Would it be possible to make
that change?
In the meantime I suppose I shall make my own parameter for keeping track of
unquote-rewriters, though this has the disadvantage of not knowing anything
about unquote-rewriters set with the with-unquote-rewriter macro.
Another thought that would require more effort, why is there only ever a single
unquote-rewriter at a time? compound-rewriters and atomic-rewriters both have a
table, allowing multiple rewriters to be layered on top of each other?
Anyway thanks,
Matias Eyzagurre.
--
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.