[plt-dev] Symptom of REPL's hopelessness?
What is the difference between generate-temporaries and gensym?
Robby
On Thu, Oct 1, 2009 at 3:11 PM, Sam TH <samth at ccs.neu.edu> wrote:
> On Thu, Oct 1, 2009 at 4:01 PM, Casey Klein
> <clklein at eecs.northwestern.edu> wrote:
>> Can someone explain why this macro expands without error in a module
>> but not in the REPL?
>>
>> (define-syntax (m stx)
>> (syntax-case stx ()
>> [(_ x)
>> (with-syntax ([(y) (generate-temporaries (syntax (x)))])
>> (syntax (define (y) y)))]))
>>
>>> (m q)
>> compile: unbound identifier (and no #%top syntax transformer is bound) in: q1
>
> This version of the macro works:
>
> (define-syntax (m stx)
> (syntax-case stx ()
> [(_ x)
> (with-syntax ([(y) (list (gensym (syntax-e #'x)))])
> (syntax (define (y) y)))]))
>
> --
> sam th
> samth at ccs.neu.edu
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-dev
>