Hello,
Self modifying code is a well known technology. Has anyone done this in Squeak? What I'm seeking for is examples of software that adds to itself (methods and variables) in runtime.
I understand from reading the Squeak documentation that it is easy to add a variable to a running object instance for a developer, but is it also possible to do from code without any developer around?
Thanks, Sten Kvamme
On Tue, 29 Apr 2003, Sten Kvamme wrote:
Hello,
Self modifying code is a well known technology. Has anyone done this in Squeak? What I'm seeking for is examples of software that adds to itself (methods and variables) in runtime.
Given that ALL the IDE in Squeak is Squeak hosted and written in Squeak, the answer is a BIG ole "yes".
Basically, ANY Squeaking that you do involves modification of the in memory system, on the fly. It could be a motto: Squeak -- self-modification out the wazoo.
I understand from reading the Squeak documentation that it is easy to add a variable to a running object instance for a developer, but is it also possible to do from code without any developer around?
Start looking at the Behavior heirarchy.
For the less faintheart (or the wise) you can always roll your own dispatcher, either directly or by doesNotUnderstand trapping. Just keep a dicitonary of blocks (and, perhaps, another dictionary of other values to simulate variables).
Feels like Python! :)
Cheers, Bijan Parsia.
Hello,
Self modifying code is a well known technology. Has anyone done this in Squeak? What I'm seeking for is examples of software that adds to itself (methods and variables) in runtime.
I understand from reading the Squeak documentation that it is easy to add a variable to a running object instance for a developer, but is it also possible to do from code without any developer around?
I don't know if this is an answer you are expected, but you can easily add instance variables to a Player. Bring up a viewer for an morph and choose 'add new (instance) variable' from the viewer's menu.
If you add a script to an EToy object, it indeed means adding a method to it.
-- Yoshiki
squeak-dev@lists.squeakfoundation.org