At Tue, 19 May 2020 20:10:01 +0000, Sage Gerard wrote:
> I'm trying to figure out how to set current-module-name-resolver in
> advance of all other code for a process. I'm guessing this would
> require a custom launcher that does (for example) `racket -l
> foo/replace-resolver bar.rkt`.
That can work if
* you either add a `-t` before `bar.rkt` to load it or
`foo/replace-resolver` handles command-line arguments; and
* you don't need to adjust resolution for any modules that are used in
the implementation of `foo/replace-resolver`.
> In that sense, I expect that a `replace-resolver` of the form below
> wouldn't work because it runs at phase 0, after the expander resolved
> everything for `bar.rkt`.
If you go the route of adding `-t` before `bar.rkt`, the resolution
will not happen until after `foo/replace-resolver` runs.
> How do I do what I mean here across all phases, for all uses of
> (dynamic-|local-)require everywhere in my program?
If you set the module name resolver, it applies to all phases.
(That's a hole in Racket's phase separation, and we don't like to talk
about it. :)