searching for a programming platform with hot code swap
- by Andreas
I'm currently brainstorming over the idea how to upgrade a program while it is running. (Not while debugging, a "production" system.)
But one thing that is required for it, is to actually submit the changed source code or compiled byte code into the running process.
Pseudo Code
var method = typeof(MyClass).GetMethod("Method1");
var content = //get it from a database (bytecode or source code)
SELECT content FROM methods WHERE id=? AND version=?
method.SetContent(content);
At first, I want to achieve the system to work without the complexity of object-orientation. That leads to the following requirements:
change source code or byte code of function
drop functions
add new functions
change the signature of a function
With .NET (and others) I could inject a class via an IoC and could thus change the source code. But the loading would be cumbersome, because everything has to be in an Assembly or created via Emit.
Maybe with Java this would be easier? The whole ClassLoader is replacable, I think.
With JavaScript I could achieve many of the goals.
Simply eval a new function (MyMethod_V25) and assign it to MyClass.prototype.MyMethod.
I think one can also drop functions somehow with "del"
Which general-purpose platform can handle such things?