[squeak-dev] Hobbes woes
Vassili Bykov
smalltalkbigot at gmail.com
Thu Sep 11 01:40:53 UTC 2008
I don't know why it's missing from those files--or why those files are
posted there in the first place, and how exactly they relate to my
stuff--but here is what it should do:
--------
accumulatePairsForBecomeIn: aBlock
"Code in aBlock will add pairs to the argument, which is an OrderedCollection.
When the block has been evaluated, all pairs will have their elements becomed.
NOTE: Do not use this method unless you understand about become."
| mutations pairs |
mutations _ self new.
aBlock value: mutations.
mutations isEmpty ifTrue: [^ self].
pairs _ mutations asArray.
Smalltalk isSqueak
ifTrue: [(pairs collect: [:p | p first])
elementsExchangeIdentityWith: (pairs collect: [:p | p second])]
ifFalse: [pairs
do: [:p | p first become: p second]]
--------
The reason it's this way is because my design requires that some of
the loaded objects become different things after loading. Individual
become: is fast in VisualWorks, but in Squeak bulk become
(elementsExchangeIdentityWith:) is the only way to get acceptable
performance.
Cheers,
--Vassili
More information about the Squeak-dev
mailing list
|