I tried it and found out (for me) that "ObjectMemory addDependent: self"
should be send in a class-method of "self". (in the case, that I did
that from an Object-method, nothing happens.) -> and so I found it in
the kernel/*.st files also.

Even #update: has to be a class method.

No, it does not need to be. Of course whatever is passed to #addDependent: (self can be either a class or an instance) should match the place where you define #update: (class or instance)

But if I did it, I always get a MessageNotUnderstood Exception...
(Would it be an idea, to maintain an OrderedCollection in the class with
all the instances of this class, to iterate over all these in the case,
the #update: class-method is getting the #aboutToQuit?)

If the above does not work, you can use a WeakSet instead. If you use an OrderedCollection nothing will be garbage collected---but then maybe that is okay for you?

Strange that you get a doesNotUnderstand though.

An aside: all instance methods of Objects are also available as class methods. That's because Object is a superclass of Behavior, which is a superclass of Class, which is a superclass of Object class, which is where class methods are defined in. Dually, there is actually no method in Object class, or maybe almost none; class methods for Object are defined in Behavior and its subclasses.

Paolo


_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to