3 ms·
Ask HN: Base code that can run indefinitely but accept new code?
I have this thought about having a tiny, low power processor as a "base" for state and it's powered by a battery source that will make it last a while and also when you charge it, no interruption, TL;DR it won't die.
But then, it can add on more code without stopping the base code. Is that possible/what would you use(language) it sounds low level.
Conceptually it sounds impossible, how can you interface with an unknown endpoint(counts).
- sharemywin 7y agoyou could look at a dll plugin. javascript has a eval function.
- ge96 7y agoweird dll sounds like the Microsoft type but it's Javascript/webpack? or maybe webpack isn't just JS...
- aawalton 7y agoErlang has done live updates to code for 30 years. Definitely possible.
- ge96 7y agothanks will check that out, I hear Erlang/Golang but not sure if related
- thijsvandien 7y agoNot related at all.
- 2rsf 7y agoI am not sure what do you mean by "stop" but I've done similar things using C some 20 years ago, here's the general idea: You should have spare memory space to accept updates, there are solutions for in-place updates but that will make things more complex so let's skip that. Once the new piece of code is in place you replace or insert an assembly jump instruction to your new code and you're good to go. This can replace the whole code, but if done smartly can replace parts of it. Think for example of using a dynamic jump table into functions.
- w3mmpp 7y agoCommon Lisp supports live compilation and loading into a running image if this processor has support for it.