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

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jan 25 19:32:44 EST 2009

At Mon, 26 Jan 2009 00:51:41 +0100, Jakub Piotr Cłapa wrote:
> 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)
>      (read-eval-print-loop)))
> 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?

We have better pieces for making this work, now, and I've put them
together into a `define-runtime-module-path' form that is exported by

> AFAIK there are no papers (other than the Reference) 
> describing the module name/namespace (especially in the context of mzc), 
> are there?

No, not so far.


Posted on the users mailing list.