Ad: instance Variables...

Dan Ingalls Dan.Ingalls at disney.com
Tue Jul 27 17:18:41 UTC 1999


>     Oooops! Sorry that I'm  spaming this mailing list, but I have a problem I'm not able to  solve... It's impossible to add  instance variable to class Object. I understand that there is something like  loop in definitions of Class, MetaClass and Object so it's necessary to  recompile these classes, but how can I add that variable!!!! I really need it!  Is there some advice, or some technique to do it?!? I need to add some instance  variable to class Class (or its superclasses).   peter.Attachment converted: BackStreet HD:Peter Novak.vcf 7 (TEXT/ttxt) (000130FA)

Peter -

The reason is simple:  The VM has various expectations regarding the forma of numerous primitive classes, such as behavior, points, streams and a few others.  Adding and instVar to object would invalidate these.

As always, when you describe a problem on this list, please say something about what you are trying to do, not just how you trying to do it.  For instance, if you simply want to add some attribute to any object (but not necessarily every one in the system), you might want to consider a mechanism similar to the dependents dictionary that makes every object *appear to* have an instance variable named dependents.

You might also want to look at the more general facility in morphic that allows any number of attributes to be attached to any morph (see Morph category access properties) by expanding one real field to many virtial fields.

You begin by saying you need to add an instVar to Object, and then say you need to add a variable to Class.  The latter can be done with Andreas's new class builder that will be released as part of the 2.5 advanced updates today.

	- Dan





More information about the Squeak-dev mailing list