Skulpt does not appear to entirely "reset" between executions. If I
have a program that is being imported using my version of Sk.read() --
that is, one that "reads" the import from a javascript variable or
cookie -- if I then change that imported program and then load and run
the importing program, it still sees the old import code, not the new
code.
The following appears to be the relevant code from import.js, which is
probably intended to prevent the same module from being imported
twice:
// if leaf is already in sys.modules, early out
var prev =
Sk.sysmodules.mp$subscript(modname);
if (prev !== undefined)
{
// if we're a dotted module, return the top level, otherwise
ourselves
if (modNameSplit.length > 1)
return
Sk.sysmodules.mp$subscript(modNameSplit[0]);
else
return prev;
}
My question is: what is the best/right way to reset Sk.sysmodules? Or
can I simply dodge this, either all the time, or simply for programs
that are imported from local memory (rather than builtins)?