[plt-scheme] syntax-parameterize
Ryan-
I just looked at the syntax-parameterize example you gave to Danny
back in April on the plt-scheme mailing list:
(define-syntax define-generator
(syntax-rules ()
[(define-generator (name . args) . body)
(define (name . args)
(let ([name
(lambda (yielder)
(syntax-parameterize
([yield
(syntax-rules ()
[(yield value)
(yielder value)])])
. body))])
(make-generator name)))]))
One common pattern with "normal" parameters is to use an expression
that refers back to their old value when you change them with a
parameterize form; the new value is only installed for the body of
the parameterize (or something along those lines; I don't know if the
semantics of parameterize are analogous to LET, or to LET*... I
assume LET...)
Can one get a similar effect with syntax-parameters? It seems like
it would be a useful thing to do at times, in order to augment
behavior rather than completely replace it.
I suppose it is impossible to make an example of such usage with
standard syntax-rules, but maybe you can make a simple syntax-case
example that I'll grok. :)
(I tried to answer my question by looking up syntax-parameterize in
the docs at
http://www.plt-scheme.org/software/mzscheme/docs.html
but did not find any mention of the construct there... it's not part
of a planet package, is it?)
-Felix