You do not need gensyms if you try to mimic or implement my suggested #. .
On the
other hand when if you do this

(define (f stx) #`(let ((x 1)) #,stx))

and use this with

#`(let ((x 2)) #,(f #'x))

the resulting expanded code would produce 1 which is not what you want.
So in the racket matcher I wrote I needed to do

(with-syntax ((x (datum->syntax stx (gensym "x")))) #`(let ((x 2)) #,(f
#'x))))))

Hope that this makes things clear!

/Stefan

On Tue, Jul 3, 2012 at 11:33 PM, Ludovic Courtès <l...@gnu.org> wrote:

> Hey!
>
> Stefan Israelsson Tampe <stefan.ita...@gmail.com> skribis:
>
> >> Stefan Israelsson Tampe <stefan.ita...@gmail.com> skribis:
> >>
> >> > Maybe this help to see what I'm after,
> >> >
> >> > #'(let ((x v)) #.(f #'x))
> >> >
> >> > <=>
> >> >
> >> > (let-syntax ((g (lambda (stx) (syntax-case  stx ((_ x) (f #'x)))))
> >> >    #'(let ((x v)) (g x))
>
> [...]
>
> > If you want to try another path using functions in stead of macros and
> > working hard with #, and #,@
> > you will for complex macros like a matcher need to gensym by hand or
> > destroy the readability of the
> > code. As illustrated by the simple example above.
>
> Hmm, the example above does not use gensym.  What am I missing?
>
> Ludo’.
>

Reply via email to