How about:

(((value class isObsolete not) and: [value isTrait not]) and: [ key == value 
name ])

not sure if it covers all the same scenarios but in my image it gave the same 
answers as before the change:
Smalltalk globals flushClassNameCache.
Smalltalk globals classNames size. 1940
Smalltalk globals nonClassNames size. 96

Cheers
Carlo

On 06 Jun 2011, at 9:28 PM, Stéphane Ducasse wrote:

fillCaches
        "Fill cachedClassNames and cachedNonClassNames. Return an array with 
the calculated values."

        | classNames nonClassNames |
        classNames := OrderedCollection new: self size.
        nonClassNames := OrderedCollection new.
        self keysAndValuesDo: [ :key :value |
                "The key == value name test below addresses two separate issues:
                        1) Obsolete classes, where key = #Foo and value name = 
'AnObsoleteFoo'
                        2) Aliases, i.e., Smalltalk at: #OtherName put: aClass"
                ((value isKindOf: (self class environment at: #Class)) and: [ 
key == value name ])
                        ifTrue: [ classNames add: key ]
                        ifFalse: [ nonClassNames add: key ] ].
                "The expression (self class environment at: #Class) deserves 
some explanation.
                For bootstrapping we need to have a different Class when 
executing value isKindOf: Class :
                In such expression Class represents a kind of fixed point: the 
class of the class of the system. 
                When bootstrapping we want the class Class of the current 
kernel defined in the current namespace.
                Since the current namespace should contains the class that 
describes itself as well as a new Class class.
                we are done :). - StephaneDucasse"
                
        classNames sort.
        cachedNonClassNames := nonClassNames sort.
        cachedClassNames := classNames.
        ^{ classNames. nonClassNames }

Stef

France - ukraine still 0-0 :)





Reply via email to