anonymous / gist:9299344
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:9299344
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
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.