

Erlang-like Hot Code Loading in Node.js - mcantelon
http://romeda.org/blog/2010/01/hot-code-loading-in-nodejs.html

======
codexon
I'm glad that someone thought my post to be interesting even though no one
found it to be good enough for a direct HN submission. However, I would like
to disagree with the statement of my hack lacking subtlety.

The way the Node.js method is performed is by changing the binding of a
function. This is possible in any dynamic language that has functions as
first-class variables such as Python. Because that type of reloading is quite
old, programmers have had a lot of time to find many problems with it: which
is why people are hesitant to suggest using Python's reload.

One of those problems is consistency. While I can't think of a simple example
off the top of my head, the blog author here acknowledges it's presence which
I believe he will soon find to be a big problem.

And most importantly, my method allows you to use a new binary. What happens
when you want to upgrade the V8 virtual machine because it has a memory leak
or a security problem? With function loading you will still need to restart.

I think Node.js will be better off implementing the spawn method I documented.

------
pierrefar
This is seriously cool. I'm constantly impressed with the amount of innovative
things done with node.js. It's a very powerful ecosystem of tools being
developed in front of our eyes.

------
mononcqc
One of the thing proper to Erlang's hot code loading is that it uses a vm-
centralized code server that handles and garbage collects the different
versions of code.

This server can in turn notify subscribers about code changes; the OTP
framework uses this to propagate code upgrades in its behaviours (gen_fsm,
gen_event [and all the handlers], gen_server) with a callback function that
lets the programmer define what changes to the data structures and state
currently in running code have to be applied.

Does node.js have anything similar to that? Or is there anything of the kind
planned?

I don't really know the in and outs of node.js, but from the blog post, it
seems like there's no way to update current state and the only real upgrades
will be done on new calls. Is this because node.js just doesn't have the same
objectives in mind?

