News for hackers. Stuff that matters.
Re:Runtime code modification. Erlang? No, Python by jerf on Thursday August 18, 2011 @02:15PM (#2900362)
It isn't that Erlang is anywhere near the only language that can do code reloading, it is that Erlang is unusual in the scope of reloading it permits and the care that it takes, to the point that reloading can be used in Erlang not as a clever hack to bridge gaps, but used as a planned update mechanism that causes zero downtime.

Since data in Erlang is immutable, you don't have to worry about what references will be left dangling. Since Erlang has no user-defined data types, you don't have to worry about redefining a class. (Big problem with Python reloading, all existing objects still belong to the old class instance.) Since Erlang is structured in terms of processes, and OTP can track which process is which thing, OTP has a defined mechanism for taking running server processes, examining their state, and allowing you to upgrade from old states to new states cleanly, and since in Erlang a process is basically nothing but its call stack and its current state, that upgrade is complete and relatively safe. You can literally upgrade a server mid-TCP connection without the client knowing.

Most languages, if poked properly, can change code at runtime. Even C can unload a dynamic library and load a new version of it at runtime. It's just that mutable values and poorly-defined boundaries between systems make it range from effectively impossible through "usable only as a desparate hack" (as seen here), Erlang makes it production-quality.

I say this only for educational purposes, not advocacy per se. I'd like to see further understanding of how Erlang works so that other language communities are more likely to pick up on the essential features of Erlang, instead of getting stuck on the superficial ones which is the usual case. (OTP is what you need to port, not "message passing"...)

Re:Runtime code modification. Erlang? No, Python by perfunctory on Friday August 19, 2011 @02:53AM (#2902516)
> OTP is what you need to port, not "message passing"...

So true.