ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? Would it be harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one argument?
Thanks, Aik-Siong Koh
I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so you don't have to send a block with an argument.
askoh wrote:
ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? Would it be harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one argument?
Thanks, Aik-Siong Koh
and just to add, when I try and use a one-arg block and try to 'do' it, I am told: " <- argument of ifNotNil: must be a 0-argument block ->"
John Thornborrow wrote:
I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so you don't have to send a block with an argument.
askoh wrote:
ifNotNil: takes block with one argument. Why not ifNil:ifNotNil:? Would it be harmful to make ifNil:ifNotNil: and ifNotNil:ifNil: take blocks with one argument?
Thanks, Aik-Siong Koh
On Tue, Apr 29, 2008 at 11:43:44AM +0100, John Thornborrow wrote:
I always use ifNotNilDo: (or ifNil:ifNotNilDo: or variant) if I need to use a block with one argument. ifNotNil: sends valueWithPossibleArgs: so you don't have to send a block with an argument.
and just to add, when I try and use a one-arg block and try to 'do' it, I am told: " <- argument of ifNotNil: must be a 0-argument block ->"
This bug is documented on Mantis at http://bugs.squeak.org/view.php?id=4867
Dave
squeak-dev@lists.squeakfoundation.org