[BUG][FIX] WeakKeyDictionary>>keysAndValuesDo:
Stephan Rudlof
sr at evolgo.de
Thu Jun 17 22:12:20 UTC 2004
Correction:
I wrote:
> ...
> My code snippet would be:
>
> | classesWithState classesWithStateAndDefinedEquality |
> classesWithState := Smalltalk allClasses select: [ :cls |
> cls isVariable or: [
> cls instVarNames isEmpty not]].
> classesWithStateAndDefinedEquality _ classesWithState select: [:class |
> class includesSelector: #= ].
>
> {classesWithState size. classesWithStateAndDefinedEquality size.
> Smalltalk allClasses size}
> #(1693 104 2596)
>
> If Object>>= will be subtracted, there remain 103 classes with newly
> added state *and* redefined #= operator.
There is no reason to subtract Object>>= (it has no state) here, 104
classes should be correct.
Greetings
Stephan
> If the remaining (1693-103) classes should also redefine #= cannot be
> said without taking a look onto them: e.g. LargeIntegersPlugin contains
> inst vars, but doesn't need a #= operator.
>
>
> Greetings
> Stephan
>
>
>>
>>
>>For 3.6 it evaluates to 1136 out of 1338 classes. The majority of them
>>is ignoring your "platonic" equality. Is Squeak grossly constructed
>>falsely regarding equality, had it just been forgotten to do it right
>>or is this an unsolvable problem? Or does it simply show what the
>>average Smalltalk programmer intuitively thinks about equality? In
>>that case the current mixed view of equality (state or identity for
>>#=) in Smalltalk may fit to the language Smalltalk. And that means
>>that Squeak Sets very well could be implemented as they are in other
>>Smalltalks.
>>
>>Regards
>>Martin
>>
>>| classes |
>>classes := Smalltalk allClasses select: [ :cls |
>> (( cls allSuperclasses add: cls; yourself ) select: [ :c |
>> c includesSelector: #= ]) size = 1 ].
>>
>>classes := classes select: [ :cls |
>> cls isVariable or: [
>> cls instVarNames isEmpty not or: [
>> ( cls allSuperclasses detect: [ :c |
>> c instVarNames isEmpty not ] ifNone: []) notNil ]]].
>>
>>classes size -> Smalltalk allClasses size
>>
>>
>>
>>
>
>
--
Stephan Rudlof (sr at evolgo.de)
"Genius doesn't work on an assembly line basis.
You can't simply say, 'Today I will be brilliant.'"
-- Kirk, "The Ultimate Computer", stardate 4731.3
More information about the Squeak-dev
mailing list
|