2004/07/08

How dynamic is your (programming) language?


I'm doing some experiments on changing classes at runtime without affecting existing instances.

With Smalltalk ( at least with Visualworks) this was a breeze: added the code for a variable, accepted it and, hey presto, any inspector open on an instance got a new variable field set to nil.

Even tried Lisp, which I haven't used for $%$ years. Why ? 'Cos you can do anything in Lisp can't you, especially this dynamics stuff? Well, I tried CLISP first, and guess what ? A redefinition to add a new slot invalidated existing instances ( or so the message said). Not taking no for an answer I accessed an old instance and crashed the whole environment.

Now it has to be said that, from the docs I have read, I wasn't sure what the behaviour should have been. Finally, I found a doc which seemed to be adamant that it should have worked. So I tried the free version of Franz' Allegro Lisp..... and it worked.

What next? Well, what can other languages such as Python and Java do in this regard? Also try to be more scientific with Lisp and Smalltalk: add/remove variables, add/remove methods, add/remove supportable etc.

No comments: