guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enhancement to the syntax system?


From: Stefan Israelsson Tampe
Subject: Re: Enhancement to the syntax system?
Date: Tue, 3 Jul 2012 23:52:29 +0200

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 <address@hidden> wrote:
Hey!

Stefan Israelsson Tampe <address@hidden> skribis:

>> Stefan Israelsson Tampe <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]