[Squeak] Newbie permutations
arning at charm.net
Tue Apr 9 10:24:59 UTC 2002
On Tue, 9 Apr 2002 11:40:14 +0200 (MEST) Torge Husfeldt <jean-jacques.gelee at gmx.de> wrote:
>IIRC there is another annoyance loosely related in the collections
>Dictionary>>copy does not copy the associations.
>Now that a dictionary consist of associations is a pure implementation
>detail and no code should rely on this fact.
Umm... what version of Squeak are you using? This seems to me to do the right thing.
'From Squeak3.3alpha of 28 January 2002 [latest update: #4817] on 9 April 2002 at 6:23:04 am'!
!Dictionary methodsFor: 'private' stamp: 'tk 8/21/97 16:12'!
"Must copy the associations, or later store will effect both the
original and the copy"
^ self shallowCopy withArray:
(array collect: [:assoc |
assoc ifNil: [nil]
ifNotNil: [Association key: assoc key
value: assoc value]])! !
More information about the Squeak-dev