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: Joachim Jaeckel
Subject: Re: [Help-smalltalk] Is there a hook (a method) which is called, if the vm ends?
Date: Fri, 03 Jul 2009 00:05:22 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Thanks Paolo,

Files are closed automatically.

Ok, but additionally, I was looking to write a summary-line at the end of the files before they are closed.

However, you can use

ObjectMemory addDependent: self.

and then "self" will get a bunch of events dispatched via the #update: method. grep "update:" in kernel/*.st for an example of its usage.

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.

But how could I call from the class, a method from the instance?

You did that in FileWrapper like this:

aspect == #aboutToQuit ifTrue: [self broadcast: #release]

and the "Object" instance is the only place, where #broadcast: is defined. (I was first looking for an implementation of #broadcast as a class-method, but I only found the one in the Object-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?)

Regards,
Joachim.




reply via email to

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