[plt-dev] Re: [plt-scheme] define-for-meta

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Thu Feb 19 15:25:28 EST 2009

Hey I asked for this a few months back and Matthew didn't grant it to  
me.


On Feb 19, 2009, at 3:12 PM, Jon Rafkind wrote:

> I would like to write a macro that can be used inside begin-for- 
> syntax, but so far the only way I can do it is by putting the macro  
> in a different file and (require (for-syntax "x.ss")) on that file.  
> Is there something akin to (define-for-meta ...) so that I can  
> define my syntax at meta phase 2 and hopefully achieve the same thing?
>
> The following won't work unless `bar' is moved to 'y.ss' (and  
> uncomment y.ss). There is no real need to do this other than  
> keeping definitions all in the same file.
>
> #lang scheme/base
>
> (require (for-syntax
>           scheme/base
>           ;; "y.ss"
>           ))
>
> (define-syntax bar
>  (syntax-rules ()
>    ((_ x)
>     (+ 1 x))))
>    (begin-for-syntax
>  (define (foo)
>    (let ([x 1])
>      (printf "foo ~a\n" (bar x))))
>
>  (foo))
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the dev mailing list.