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

Paolo Bonzini bonzini at gnu.org
Fri Sep 5 06:33:59 BST 2008


>> The standard can force implementation to support both cases.  That's
>> slowly becoming the standard.
> 
> Agreed, although bi-arity isn't really to my taste. [...]
> 
>    ifNotEmptyDo: monadicBlock
>    ifNotEmptyDo: monadicBlock ifEmpty: niladicBlock

I'll just point out that #ifNotEmptyDo:, for me is a shortcut for

   x isEmpty ifTrue: [ x do: monadicBlock ]

which is a good reason for supporting bi-arity instead of overloading
the meaning of "do".

Paolo




More information about the ANSI-Smalltalk mailing list