[racket] syntax-local-value of define-syntax-class

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Mon Feb 27 15:34:52 EST 2012

Are you looking for the "reify-syntax-class" form from
syntax/parse/experimental/reflect, perhaps?

http://docs.racket-lang.org/syntax/Experimental.html?q=syntax/parse#%28form._%28%28lib._syntax/parse/experimental/reflect..rkt%29._reify-syntax-class%29%29

Carl Eastlund

On Mon, Feb 27, 2012 at 3:32 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:

>  Ok but it still doesn't work if I take out the (begin-for-syntax).
>
> (define-syntax-class x)
>
> Now its defined at phase 0. Anyway if I can get the syntax class I can
> access its attributes (ryan said it was ok).
>
>
> On 02/27/2012 01:28 PM, Carl Eastlund wrote:
>
> You've bound x at phase 1, but you're looking up a phase 0 binding here.
>
> Bug aside, I had no idea there was anything meaningful for external users
> to do with the values underlying syntax classes.  What does the value let
> you do?
>
> Carl Eastlund
>
> On Mon, Feb 27, 2012 at 3:21 PM, Jon Rafkind <rafkind at cs.utah.edu> wrote:
>
>> I thought syntax-local-value would produce the syntax-class object that a
>> given identifier is bound to but it errors out with 'x is not defined as
>> syntax'. Any ideas why? There is one part of my original code base where
>> this works and another where it doesn't. I cannot seem to replicate the
>> part that works in a small test case.
>>
>> #lang racket
>>
>> (require (for-syntax syntax/parse))
>>
>> (begin-for-syntax
>>  (define-syntax-class x))
>>
>> (define-syntax (bar stx)
>>  (syntax-case stx ()
>>    [(_ name) (syntax-local-value #'name)]))
>>
>> (bar x)
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120227/3edb41ce/attachment-0001.html>

Posted on the users mailing list.