Skip to content

anonymous /gist:9299344

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
class Module {
map<string, Code> exports;
// string = exported function name
// Code = actual code
list<Processes> processes;
// list of processes spawned using this module
}
class ModulePair {
Module old_module; // the old code, if any
Module new_module; // the current code
}
class Runtime {
map<string, ModulePair> mps;
// string = name of Module
// ModulePair = old + new module
}
Runtime myRuntime;
void compile(string module_name, string code) {
// kill all the the processes that are 3 generations old
list<Processes> zombies = myRuntime.mps[module_name].old_module.processes;
for(proc in zombiles) kill proc;
// replace the old module's code
myRuntime.mps[module_name].old_module = myRuntime.mps[module_name].new_module;
// link in the new module's new code
myRuntime.mps[module_name].new_module = ...(code)
}
// anytime we lookup something of the form
// foo:bar()
// we always look at the latest copy of foo
void lookup(string module_name, string func_name) {
return myRuntime.mps[module_name].new_module.exports[func_name]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.