[plt-scheme] Can generated lexical (syntax) bindings work?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Apr 9 06:15:49 EDT 2007

At Mon, 9 Apr 2007 02:40:01 -0700, Brian Chin wrote:
> The code follows. It's a little long, but hopefully its clear enough:

It needs one tiny change:

> (define-syntax (define-syntax-in-context stx)
>    [...]
>    (syntax (begin
>              (define-syntax fresh-id transformer)
>              (begin-for-syntax
>                (add-syntax-id-to-context 'context 'name 'fresh-id))))))))
                                                          ---------

Change 
   'fresh-id
to
   #'fresh-id
or, equivalently, 
   (syntax fresh-id)

This works because `(syntax fresh-id)' produces a syntax-object
identifier in the same way that `(quote fresh-id)' produces a symbol.

Matthew



Posted on the users mailing list.