Ralph Johnson and I descibed some work we did to allow more dynamic, per-instance changes to objects so that they could act more like prototypes many moons ago in Smalltalk itself in http://laputa.isdn.uiuc.edu/ref89/ref89.html at OOPSLA '89.
In those days, there was no changeClassToThatOf:, so we had to <add> a class change primitive ourselves. We also added a bit to the object headers to force a doesNotUnderstand: like exception (dispatchMessage:) at the start of the lookup process instead of the end.
Once you can clone yourself quickly, and change your parent/class pointer, the one thing left is adding a method or variable slot. You can do that by adding a LightWeight class (a.k.a. HeavyweightObject or MetaObject), or with instance "clone and becomes:" tricks. Adding a lightweight Behavior gives you a place to put methods or state.
Extensible dynamic instance variables can also be simulated using dictionaries (http://laputa.isdn.uiuc.edu/dfc/discussion#Accessible) and doesNotUnderstand:.
(The change class and dispatch hacks were patched in in binary, with MPW C , the assembler, and the debugger. We got a lot of bits under our fingernails...)
Obligatory Squeak Content: these sorts of VM alterations are a <lot> easier under Squeak.
The thing that was interesting about how Self did dynamic slots was the implicit meta-architecture under the hood (the maps and all) that made it possible to do these dynamic things, and yet run efficiently when you knew you weren't doing them.
Since Self's VM was a big C++ program, making this part of the system first-class objects wasn't something they were too enthusiastic about. I was always frustrated that you couldn't get your hands on these too.
I sense considerable enthusiasm for fleshing out this part of the architectural tale in this community: the objects that connect the object models and implementation. These can make experimentation with a variety of models possible. In any case, it's good to see the MOP hackers getting flushed out into the open...
As for Mike's point about dangerous facilities, I'm for refactoring things in such a way as to give us the dynamic power to make such facilities easier to hide.
--BF
squeak-dev@lists.squeakfoundation.org