[racket] requiring in multiple phases

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Mon May 21 14:28:14 EDT 2012

(define-syntax-rule (require-for-all req ...) (require (for-meta -1 req ...) (for-meta 0 req ...) (for-meta 1 req ...))
(require-for-all "a.rkt" "b.rkt" "c.rkt")

should work afaik

On 05/21/2012 11:39 AM, Neil Van Dyke wrote:
> If I want to "require" a module for multiple phases, is there a shortcut for that?
>
> For example, right now, I have this in a real-world file:
>
> (require (for-syntax racket/base
>                      syntax/parse
>                      "html-template-generate.rkt"
>                      "html-template-parse.rkt"
>                      "planet-neil-html-writing.rkt")
>          (for-template "html-template-generate.rkt"
>                        "html-template-parse.rkt"
>                        "planet-neil-html-writing.rkt")
>          syntax/parse
>          "html-template-generate.rkt"
>          "html-template-parse.rkt"
>          "planet-neil-html-writing.rkt"
>          "planet-neil-mcfly.rkt")
>
> I would prefer less duplicated text for modules that I know I need to "require" 3 different ways:
>
> (require (for-darned-near-every-phase "html-template-generate.rkt"
>                                       "html-template-parse.rkt"
>                                       "planet-neil-html-writing.rkt")
>          (for-syntax racket/base
>                      syntax/parse)
>          syntax/parse
>          "planet-neil-mcfly.rkt")
>
> Unless I'm doing something wrong, needing a module 3 different ways doesn't seem too unusual with the new-fangled syntax transformers.
>
> (I don't know whether I'll need quite as many "require"s once submodules make it into the Racket release.)
>
> Neil V.
>
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users


Posted on the users mailing list.