Oh, thanks. This was useful!


On 21 Jul 2014, at 21:02, Nicolai Hess <nicolaihess@web.de> wrote:

during
Object subclass: #SomeClass instanceVariableNames: 'one'
the announcement is send and your class var points to the old class definition.
after
Object subclass: #SomeClass instanceVariableNames: 'one'
is done, your class var points to the new class definition.
And yes, I think it is the wrong behavior. The announcement is not useful
if it announces this change before the class has changed.

There is a bug report for this:

13020 ClassModifiedClassDefinition should be announced AFTER the class is changed






2014-07-21 20:09 GMT+02:00 Yuriy Tymchuk <yuriy.tymchuk@me.com>:
Hi, I did this small experiment

class := Object subclass: #SomeClass.
SystemAnnouncer uniqueInstance
        when: ClassModifiedClassDefinition
        do: [ :ann |
                Transcript cr;
                        crShow: class == ann oldClassDefinition;
                        crShow: class == ann newClassDefinition ].
 Transcript
        crShow: class == (Object subclass: #SomeClass instanceVariableNames: 'one' ).

and got

true
false
true

I could understand getting true, false, false, and so having a new object for a new class, or getting false, true, true e.i getting the same object and oldClassDefinition would be a mock that can be used for consistency.

How is all this thing working? Because I�m tracking classes and I need to switch to another object if it�s changed and evaluate some methods. But I can�t evaluate them on newClassDefinition because it�s a different object, and I can�t do it on oldClassDefinition because it�s old�


I would be very grateful.
Uko