I find the example too abstract to understand why the computation happens at the "wrong phase" when you adjust the code with `begin-for-syntax'. Can you explain a little more, maybe with a more concrete example?
Just in case, here's the code that I think you have in mind for "wrong phase": #lang racket/load (module m1 racket (define l (list #'l)) (provide l)) (module m2 racket (require (for-syntax 'm1)) (define-syntax (mac stx) #`(begin-for-syntax (module* sub #f (length (list #,(car l)))))) (provide mac)) (module m3 racket (require 'm2) (mac)) (require (submod 'm3 sub)) At Thu, 5 Jul 2012 17:17:08 -0400, Sam Tobin-Hochstadt wrote: > I'd like to write a program basically like this: > > #lang racket/load > > (module m1 racket > (define l (list #'l)) > (provide l)) > > (module m2 racket > (require (for-syntax 'm1)) > (define-syntax (mac stx) > #`(module* sub #f > (length (list #,(car l))))) > (provide mac)) > > (module m3 racket > (require 'm2) > (mac)) > > But I can't come up with any way to `require` m1 appropriately so that > `l` is bound in the generated submodule. If I wrap the body of the > submodule in `begin-for-syntax`, then it works, but then loading the > submodule does the computation at the wrong phase. So another > solution would be `dynamic-require-for-template`, if that's feasible. > -- > sam th > sa...@ccs.neu.edu _________________________ Racket Developers list: http://lists.racket-lang.org/dev