[plt-scheme] Attaching modules to namespaces in compiled code

From: Jakub Piotr Cłapa (jpc-ml at zenburn.net)
Date: Sun Jan 25 18:51:41 EST 2009

I already asked this question here once but AFAICT some things changed 
since then.

I have the following code fragment:
(let ([ns (make-base-namespace)]
       [sepack-mod (module-path-index-resolve (module-path-index-join 
"sepack.ss" (syntax-source-module #'here)))])
   (namespace-attach-module (current-namespace) sepack-mod ns)
   (parameterize ([current-namespace ns]
                  [current-prompt-read prompt])
     (namespace-require sepack-mod)

The last time I tried to do this I had to manually resolve the name 
recursively (I basically copied and pasted the code Matthew suggested). 
The module-path-index-resolve is certainly nicer but I am curious 
whether it can be improved upon:
1. Quite a few functions are needed to acquire one module path.
2. As far as I understand I still need to require the module statically 
somewhere (even if it is needed only in dynamically evaluated code) for 
mzc to compile it in. Can this be fused with define-runtime-path somehow?

I really admire the thought you put into the module system and 
especially the machinery required to make it work in self-contained 
executables. AFAIK there are no papers (other than the Reference) 
describing the module name/namespace (especially in the context of mzc), 
are there?

Jakub Piotr Cłapa

Posted on the users mailing list.