Stef, I don't have an ifEmptyOrNil: in my image only isEmptyOrNil and that is specified for Collection and UndefinedObject. Did I miss something? Norbert On Sun, 2008-10-05 at 11:31 +0200, Stéphane Ducasse wrote:
Hi
I would like to have your take on that one:
isEmpty "Answer whether the receiver contains any elements."
^self size = 0
Why do we need ifEmptyOrNil:
isEmptyOrNil "Answer whether the receiver contains any elements, or is nil. Useful in numerous situations where one wishes the same reaction to an empty collection or to nil" ^ self isEmpty
why can we use isEmpty: or ifEmpty: aBlock
ifEmpty: aBlock "Evaluate the block if I'm empty" ^ self isEmpty ifTrue: aBlock
Then from an implementation point of view ifEmptyOrNil: is bogus since it never returns nil (or should not and is also ill-specified). I checked ANSI and this is really a boolean.
I'm the mood to deprecate this method. Stef
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project