[ANSI-Smalltalk] Re: A list of interesting methods, ifNotNil:

Paolo Bonzini bonzini at gnu.org
Sat Sep 6 08:47:52 BST 2008


>>>> x isEmpty ifFalse: [ x do: monadicBlock ]
>>
>> hi! in what ways is this different than
>>
>> x do: monadicBlock
> 
> Would be surprising if it was different, I would think.

Yes, of course it would not.  But you could have

  x ifEmpty: block1 ifNotEmpty: block2

vs.

  x ifEmpty: block1 ifNotEmptyDo: block2

And I say *could*, I'm not endorsing this particular addition -- I'm
just using to show why IMO using the "do" suffix to choose between zero-
and one-arity blocks is bad.

Paolo



More information about the ANSI-Smalltalk mailing list