I think you want to use `quote-module-path` here: #lang racket
(require syntax/location) (module food racket (provide apple) (define apple "pie")) (parameterize ([current-namespace (make-base-namespace)]) (namespace-require (quote-module-path food)) (eval 'apple)) On Sun, Oct 29, 2017 at 12:19 PM, Junsong Li <ljs.darkf...@gmail.com> wrote: > Hello list, > > I am trying to do namespace-require to a submodule, racket complains about > unknown module, as below: > > $ cat go.rkt > #lang racket > > (module food racket > (provide apple) > (define apple "pie")) > > (parameterize ([current-namespace (make-base-namespace)]) > (namespace-require ''food) > (eval 'apple)) > > $ racket go.rkt > require: unknown module > module name: #<resolved-module-path:'food> > context...: > > > Simply namespace-require food in toplevel has the same issue: > > #lang racket > > (module food racket > (provide apple) > (define apple "pie")) > > (namespace-require ''food) > > Finally, the above code works if I type them in the interactive mode. > > I tried namespace-attach-module, and I understand why that failed: it didn't > work because (module food racket ...) wouldn't instantiate the module, and a > instantiated module is what namespace-attach-module wants. > > What is it that I am missing in above code to require a submodule in a > namespace? Why is submodule food invisible here? > > > - Junsong > > -- > 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 racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.