[plt-scheme] dynamic-*un*-require?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sat Oct 25 08:03:30 EDT 2008

At Sat, 25 Oct 2008 04:43:44 -0700, YC wrote:
> On Fri, Oct 24, 2008 at 6:53 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 
> >
> > The `enter!' form of `scheme/enter' re-loads a module when its file
> > timestamp changes --- as long as the module was originally loaded via
> > `enter!'.
> >
> 
> Matthew - this is way cool!  From the implementation it seems that the core
> ideas are:
> 
> 1. use custom load/used-compiled-handler to keep track of module
> dependencies and timestamps
> 
> 2. when loading a module, verify that its dependency also needs to be
> reloaded.
> 
> 3. `eval` *is* what causes the module to be recompiled.

Yes, essentially.

More precisely, the `get-module-code' function actually recompiles the
module. The `eval' call takes that compiled code and registers it as
the module's declaration.

> The part where I don't understand the usage of `module->namespace` to reset
> `current-namespace`.  Doesn't that mean if I have symbols introduced via
> other means they are no longer visible?

Right --- but that's what `enter!' is supposed to do. It supposed to
"enter" the module body by switching the current namespace to the
module's namespace.

Probably you want something like `enter!', but without switching the
namespace.


Matthew



Posted on the users mailing list.