Hacker News new | ask | show | jobs
by sausagefeet 5746 days ago
Isn't this still a problem in a dynamic language? For example in Erlang let's say my state is the 2-tuple. In version 2 I make it a 3-tuple but it stays the same in version 3 so it has no upgrade code. Consider the same situation with any code where the middle version update adds data to your state.

I'm not sure why being statically typed would make hot code loading impossible. Can't you always interject some transformation function between updates? At the very worse you could have code to serialize your data structure right before update, then another function after the update to deserialize and turn it into the new structure. Am I missing something?

1 comments

There are two things. First, although the above transformation is theoretically possible to achieve with statically typed language, it is for sure harder in practice. In contrast, in Erlang it is super easy and natural although it may often seem as ad-hoc. But being able to do something like like on the fly is tremendously useful in practice.

Second, which is more important -- in my first example, I forgot to mention about the ability to use two versions of the same module at the same time. Check the thread below for more details.