Marcel Taeumel uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-mt.834.mcz
==================== Summary ====================
Name: Collections-mt.834 Author: mt Time: 21 May 2019, 10:47:25.375822 am UUID: 505856e5-ecbf-cf41-ab6d-ef0b7b3dd45b Ancestors: Collections-mt.833
Replace the few sends to #valueWithPossibleArgument: with #cull: because there is no need to expect blocks with more than one argument to be filled with nils. Updates comments.
=============== Diff against Collections-mt.833 ===============
Item was changed: ----- Method: Collection>>ifEmpty: (in category 'testing') ----- ifEmpty: aBlock + "Evaluate aBlock if I'm empty, return myself otherwise." - "Evaluate the block if I'm empty"
+ self isEmpty ifTrue: [^ aBlock value].! - self isEmpty ifTrue: [ ^aBlock value ]!
Item was changed: ----- Method: Collection>>ifEmpty:ifNotEmpty: (in category 'testing') ----- ifEmpty: emptyBlock ifNotEmpty: notEmptyBlock + "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise. If the notEmptyBlock has an argument, evalualte it with myself as its argument. See also #ifEmpty:ifNotEmptyDo:." - "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise" - " If the notEmptyBlock has an argument, eval with the receiver as its argument"
+ self isEmpty ifTrue: [^ emptyBlock value]. + ^ notEmptyBlock cull: self! - self isEmpty ifTrue: [ ^emptyBlock value ]. - ^notEmptyBlock valueWithPossibleArgument: self!
Item was changed: ----- Method: Collection>>ifNotEmpty: (in category 'testing') ----- ifNotEmpty: aBlock + "Evaluate aBlock if I'm not empty, return myself otherwise. If aBlock has an argument, evaluate it with myself as its argument. See also #ifNotEmptyDo:." - "Evaluate the given block unless the receiver is empty.
+ self isEmpty ifFalse: [^ aBlock cull: self].! - If the block has an argument, eval with the receiver as its argument, - but it might be better to use ifNotEmptyDo: to make the code easier to - understand" - - self isEmpty ifFalse: [^ aBlock valueWithPossibleArgument: self]. - !
Item was changed: ----- Method: Collection>>ifNotEmpty:ifEmpty: (in category 'testing') ----- ifNotEmpty: notEmptyBlock ifEmpty: emptyBlock + "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise. If the notEmptyBlock has an argument, evaluate it with myself as its argument. See also #ifNotEmptyDo:ifEmpty:." - "Evaluate emptyBlock if I'm empty, notEmptyBlock otherwise - If the notEmptyBlock has an argument, eval with the receiver as its argument"
+ self isEmpty ifFalse: [^notEmptyBlock cull: self]. + ^ emptyBlock value! - self isEmpty ifFalse: [ ^notEmptyBlock valueWithPossibleArgument: self ]. - ^emptyBlock value!
packages@lists.squeakfoundation.org