[racket-dev] A strange problem with namespaces

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Wed May 7 10:11:49 EDT 2014

This program: https://gist.github.com/samth/e7b55fcef66da9b8416a works
when line 33 is uncommented, otherwise it gives the error:

?: module mismatch;
 attempted to use a module that is not available
  possible cause:
   using (dynamic-require .... #f)
   but need (dynamic-require .... 0)
  module: (submod "weird.rkt" evaluator)
  phase: 0
  in: phase1-phase0-run
  context...:
   weird.rkt: [running body]

>From reading the docs on `dynamic-require`, I can see that
`(dynamic-require m 'f)` doesn't make anything available for higher
phases.  However, the actual `dynamic-require` in the program is just
for a function -- the need for higher phases is an implementation
detail that's leaking in because it doesn't behave like a regular
value wrt `dynamic-require`.

Is there something I can change in the implementation of the internals
of `f` so that clients of `f` don't need to do the extra
`(dynamic-require m 0)` in order for `f` to work?

Sam

Posted on the dev mailing list.