
Ask HN: Base code that can run indefinitely but accept new code? - ge96
I have this thought about having a tiny, low power processor as a &quot;base&quot; for state and it&#x27;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&#x27;t die.<p>But then, it can add on more code without stopping the base code. Is that possible&#x2F;what would you use(language) it sounds low level.<p>Conceptually it sounds impossible, how can you interface with an unknown endpoint(counts).
======
2rsf
I 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.

------
aawalton
Erlang has done live updates to code for 30 years. Definitely possible.

~~~
ge96
thanks will check that out, I hear Erlang/Golang but not sure if related

~~~
thijsvandien
Not related at all.

------
w3mmpp
Common Lisp supports live compilation and loading into a running image if this
processor has support for it.

------
sharemywin
you could look at a dll plugin.

javascript has a eval function.

~~~
ge96
weird dll sounds like the Microsoft type but it's Javascript/webpack? or maybe
webpack isn't just JS...

