[plt-dev] Symptom of REPL's hopelessness?
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