help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Is there a hook (a method) which is called, if the


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Is there a hook (a method) which is called, if the vm ends?
Date: Fri, 03 Jul 2009 07:40:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2


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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]