[Pharo-project] supporting bootstrap
Hi guys with ben we changed ((value isKindOf: Class) and: [ key == value name ]) into 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: Class) and: [ key == value name ]) ifTrue: [ classNames add: key ] ifFalse: [ nonClassNames add: key ] ]. classNames sort. cachedNonClassNames := nonClassNames sort. cachedClassNames := classNames. ^{ classNames. nonClassNames } by ((value isKindOf: (self at: #Class)) and: [ key == value name ]) and this is not a good change because it assumes that an environment has a class Class and it jumps over the fix point created by the compiled time binding to Class. Now we did that because in Hazel we build a new kernel and the new environment needs to have its own Class class. Now I have the impression that ((value isKindOf: (self environment at: #Class)) and: [ key == value name ]) is the solution since HSystemDictionary which should be defined in itself could work Now if somebody has a better idea, I'm all ears (esepcially sincewe do not have a nice object to dispatch on). stef
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 :)
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 :)
Sorry ignore...didn't read your comment... On 06 Jun 2011, at 9:51 PM, Carlo wrote: 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 :)
On 6 June 2011 22:54, Carlo <snoobabk@yahoo.ie> wrote:
Sorry ignore...didn't read your comment...
On 06 Jun 2011, at 9:51 PM, Carlo wrote:
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 }
why not just use #isBehavior?
Stef
France - ukraine still 0-0 :)
-- Best regards, Igor Stasenko AKA sig.
participants (3)
-
Carlo -
Igor Stasenko -
Stéphane Ducasse