The problem is that `namespace-require` has to first resolve the `racket` module path, and the module name resolver uses the current namespace as determined by `current-namespace` --- which means that the resolver loads the `racket` module into the wrong namespace.
I doubt that we can change that behavior without breaking something. Probably this will need to be addressed with a documentation improvement that discourages providing a namespace directly except in limited cases. At Mon, 6 Jan 2020 19:09:44 -0800 (PST), Yongming Shen wrote: > Hi, I have encountered a counterintuitive behavior of namespace-require and > wonder if it is a bug. > Basically, namespace-require behaves differently when the target namespace > is passed by parameterizing current-namespace, compared to when the > optional namespace parameter is used. > > For example, this works: > > (define ns (make-base-empty-namespace)) > (parameterize ([current-namespace ns]) (namespace-require 'racket)) > > But this gives an error about unknown module: > > (define ns (make-base-empty-namespace)) > (namespace-require 'racket ns) > > require: unknown module > module name: #<resolved-module-path:"/Applications/Racket > v7.3/collects/racket/main.rkt"> > > Am I doing something wrong in the second case? > > Thanks, > Yongming > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/racket-users/45e0ee10-0ce0-42a9-997f-ad102e09 > 8ea4%40googlegroups.com. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/5e13fad3.1c69fb81.e0aae.b3e0SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

