Hi,

#isObsolete is interesting… it used to be that there were two definitions “name 
of class starts with ‘AnObsolete’.
(these checks where inlined everywhere). And #isObsolete was checking “my 
environment knows my name and
the result is me”. 

-> we refactored the system to use #isObsolete everywhere (one of those 
unimportant cleanups aka “random refactorings”)

Then Yuriy wanted to annotate classes like we can already annotate the AST and 
Methods. So he added a property API
(careful to now use space by storing in a ClassVar).

Then Andrei realized that our definition of #isObsolte does not work for 
anonymous behaviors… so should we go back
to “self name beginsWith:”? 

No! The property interface now allows us to solve this how you think it works: 
we tag obsolte classes.

isObsolete
        "Return true if the receiver is obsolete."
        ^self propertyValueAt: #obsolete ifAbsent: false

This works, even for anonymous classes.  And it is *fast*:

[Smalltalk  allClasses do: #isObsolete] bench 

Pharo 3: '147 per second.’
Pharo 4: '95.562 per second’


        Marcus
 

Reply via email to