Gilad writes about JSR292 (Supporting Dynamically Typed Languages on the JavaTM Platform) and adding support in the JVM for updating a program’s code without stopping the program. Since hotswapping is part of the general “dynamically typed languages support” JSR, I guess the main focus is on the kind of updates required by a full implementation of languages like Python or Ruby, where a program can change the class of an object, add methods to a class, etc. In other words updates where a program itself changes its own structure.
What is most interesting to me in all this, though, is the kind of hotswapping that allows you to develop applications while they’re running, as demonstrated in this smalltalk screencast. When I spent a lot of time working on a particular corner of our IDE I tend to focus too much on the details and forget the big picture. Watching that video, I was reminded of what kind of system we should, and do, aim to make OSVM, and that’s probably the kind of interactive programming Gilad has in mind when he talks about how powerful and useful hotswapping is.
In my experience you don’t need full hotswapping for it to be useful. Eclipse, for instance, only supports relatively limited updates — all you can do, more or less, is change the implementation of existing methods. It is still very useful, though, and far preferable to always having to restart everything after every little change. Even if they fall short of a general solution, any steps they can take in the right direction will be great.
Wow, that sounded a lot like me being positive. That’s so unlike me.
Implementing support for this in OSVM was, to say the least, non-trivial. And our VM is not only very simple but was also designed with this kind of use in mind. As for implementing this in the JVM… as they say, good luck with that. But of course this JSR doesn’t have to be ready until Java SE 7 so they have a few years to get it done.