[squeak-dev] The Trunk: Collections-ul.959.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Sep 13 18:12:26 UTC 2021


Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.959.mcz

==================== Summary ====================

Name: Collections-ul.959
Author: ul
Time: 13 September 2021, 8:09:57.683039 pm
UUID: 38711725-42d6-45cb-8915-e517d1fc8fd8
Ancestors: Collections-eem.958

- WeakIdentityDictionary and WeakKeyDictionary must implement #at:ifPresent:
- WeakKeyDictionary must also override #at:ifPresent:ifAbsent:
- implement KeyedSet >> #at:ifPresent:ifAbsent: while at these methods
- CharacterSet class >> #cleanUp: was missing two cached instances: Ascii and NonAscii

=============== Diff against Collections-eem.958 ===============

Item was changed:
  ----- Method: CharacterSet class>>cleanUp: (in category 'initialize-release') -----
  cleanUp: aggressive
  
+ 	CrLf := NonSeparators := Separators := Ascii := NonAscii := nil!
- 	CrLf := NonSeparators := Separators := nil!

Item was added:
+ ----- Method: KeyedSet>>at:ifPresent:ifAbsent: (in category 'accessing') -----
+ at: key ifPresent: oneArgBlock ifAbsent: absentBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the
+ 	 value of evaluating the oneArgBlock with the value associated
+ 	 with the key, otherwise answer the value of absentBlock."
+ 
+ 	^(array at: (self scanFor: key))
+ 		ifNil: [ absentBlock value ]
+ 		ifNotNil: [ :value | oneArgBlock value: value enclosedSetElement ]!

Item was added:
+ ----- Method: WeakIdentityDictionary>>at:ifPresent: (in category 'accessing') -----
+ at: key ifPresent: aBlock 
+ 	"Lookup the given key in the receiver. If it is present, answer the value of evaluating the given block with the value associated with the key. Otherwise, answer nil."
+ 
+ 	^(array at: (self scanFor: key)) ifNotNil: [ :association |
+ 		association == vacuum ifFalse: [
+ 			aBlock value: association value ] ]!

Item was added:
+ ----- Method: WeakKeyDictionary>>at:ifPresent: (in category 'accessing') -----
+ at: key ifPresent: aBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the value of evaluating the given block with the value associated with the key. Otherwise, answer nil.
+ 	While no nil key can be added, keys become nil when they are garbage collected.
+ 	This must not let nil accidentally 'inherit' the value of such a stale association."
+ 
+ 	^key ifNotNil: [ super at: key ifPresent: aBlock ]!

Item was added:
+ ----- Method: WeakKeyDictionary>>at:ifPresent:ifAbsent: (in category 'accessing') -----
+ at: key ifPresent: oneArgBlock ifAbsent: absentBlock
+ 	"Lookup the given key in the receiver. If it is present, answer the
+ 	 value of evaluating the oneArgBlock with the value associated
+ 	 with the key, otherwise answer the value of absentBlock."
+ 
+ 	^key ifNotNil: [ super at: key ifPresent: oneArgBlock ifAbsent: absentBlock ]!



More information about the Squeak-dev mailing list