[etoys-dev] Etoys: Collections-bf.7.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun May 23 21:38:58 EDT 2010
Bert Freudenberg uploaded a new version of Collections to project Etoys:
http://source.squeak.org/etoys/Collections-bf.7.mcz
==================== Summary ====================
Name: Collections-bf.7
Author: bf
Time: 24 May 2010, 3:38:49 am
UUID: edc52a80-1dda-4f74-bd24-d43771cf6cf5
Ancestors: Collections-Richo.6
- revert Dictionary>>at:ifAbsentPut: to its non-optimized but correct version (fixes DNU when updating)
=============== Diff against Collections-Richo.6 ===============
Item was changed:
----- Method: Dictionary>>at:ifAbsentPut: (in category 'accessing') -----
at: key ifAbsentPut: aBlock
"Return the value at the given key.
If key is not included in the receiver store the result
of evaluating aBlock as new value."
+ ^ self at: key ifAbsent: [self at: key put: aBlock value]!
- | assoc index value |
- index := self findElementOrNil: key.
- assoc := array at: index.
- ^assoc
- ifNil: [ value := aBlock value.
- self atNewIndex: index put: (Association key: key value: value). value]
- ifNotNil: [assoc value].
-
- " optimized version of:
- ^ self at: key ifAbsent: [self at: key put: aBlock value]
- "!
More information about the etoys-dev
mailing list