[racket] Extending syntax-parameters?
I have a syntax parameter that is bound to a transformer. I want to (at certain points) change the parameterization of this parameter to a new transformer that depends on the old one.
I can't do this:
#'(syntax-parameterize ([p (syntax-parser
[pat (some-combination-of (syntax-parameter-value #'p) pat))])])
blah)
Because the value fetched is the inner most one, but I want what it is currently.
I tried to be cute and create a table keyed by gensyms like so:
(define g (gensym))
#`(syntax-parameterize ([p-table (hash-set (syntax-parameter-value #'p-table)
'#,g
(syntax-parameter-value #'p))]
[p (syntax-parser
[pat (some-combination-of
(hash-ref (syntax-parameter-value #'p-table) '#,g)
pat)])])
blah)
But it complains that
write: cannot marshal value that is embedded in compiled code
value: #<rename-transformer>
What is the right way to get this scope to work out, if possible?
Thanks,
-Ian