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

_________________________________________________
 For list-related administrative tasks:
 http://list.cs.brown.edu/mailman/listinfo/plt-dev

Reply via email to