Matthew Flatt <mfl...@cs.utah.edu> writes: > Every once in a while, I find that option 2 works well with the pattern > > foo.rkt: > #lang racket > (define-logger foo) ; uses `(current-logger)` > > bar.rkt: > #lang racket > (define-logger bar) ; uses `(current-logger)` > > main.rkt: > #lang racket > (require "foo.rkt" > "bar.rkt") > > (module configure-runtime racket/base > (define-logger main) > (current-logger main-logger) ; sets `(current-logger)` early > ....) > > (require (submod "." configure-runtime)) > > The `configure-runtime` submodule name is special: when "main.rkt" is > run as a program, then `configure-runtime` is loaded and instantiated > first --- before the result of "main.rkt", and before the imported > "foo.rkt" and "bar.rkt" modules. > > This strategy only makes sense for configuration that is especially > main-like, though. It doesn't compose for larger things that are built > on "main.rkt".
Excellent, thanks! This will work well for part of my program. I recently discovered submodules, but did not know about configure-runtime. One thing is missing from the pattern above: (provide main-logger). Thanks, Aidan ____________________ Racket Users list: http://lists.racket-lang.org/users