[squeak-dev] The Inbox: Collections-ul.136.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] The Inbox: Collections-ul.136.mcz

commits-2
A new version of Collections was added to project The Inbox:
http://source.squeak.org/inbox/Collections-ul.136.mcz

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

Name: Collections-ul.136
Author: ul
Time: 17 September 2009, 6:23:30 am
UUID: 4673316d-d3a8-844b-9efc-482078ed4109
Ancestors: Collections-ul.135

- primitive 60 won't help with Array >> #at:ifAbsent: because it accepts only one parameter, so changed SequenceableCollection >> #at:ifAbsent: to get some improvement (assumes that indexes greater than the upper bound are more common than indexes smaller than the lower bound)

=============== Diff against Collections-ul.135 ===============

Item was changed:
  ----- Method: SequenceableCollection>>at:ifAbsent: (in category 'accessing') -----
  at: index ifAbsent: exceptionBlock
  "Answer the element at my position index. If I do not contain an element
  at index, answer the result of evaluating the argument, exceptionBlock."
 
+ (index <= self size  and: [ 1 <= index ]) ifTrue: [ ^self at: index ].
+ ^exceptionBlock value!
- (index between: 1 and: self size) ifTrue: [^ self at: index].
- ^ exceptionBlock value!

Item was removed:
- ----- Method: Array>>at:ifAbsent: (in category 'accessing') -----
- at: index ifAbsent: exceptionBlock
- "Optimized to go through the primitive if possible"
-
- <primitive: 60>
- (index between: 1 and: self size) ifTrue: [ ^self at: index ].
- ^exceptionBlock value!