Shouldn't ifEmpty return self?
Klaus D. Witzel
klaus.witzel at cobss.com
Mon Jun 12 21:38:37 UTC 2006
On Mon, 12 Jun 2006 22:15:51 +0200, Benjamin Schroeder wrote:
> On Jun 12, 2006, at 3:33 PM, Klaus D. Witzel wrote:
>> Besides, the current Squeak implementaton of #ifEmpty: does not send
>> #value to its argument (a block) ... this method is perhaps an example
>> of one bug not canceling the other one ;-)
>
> The block ends up having #value sent to it by #ifTrue: (when
> appropriate). #ifEmpty: just passes it along.
>
> "Evaluate the block if I'm empty"
>
> ^ self isEmpty ifTrue: aBlock
>
Ah. And I was believing the description in True>>#ifTrue:
-------
ifTrue: alternativeBlock
"Answer the value of alternativeBlock. Execution does not actually
reach here because the expression is compiled in-line."
^alternativeBlock value
-------
So the bug is in the documentation? This is not an easy one: who would
doubt the implementation of such an essential behavior?
/Klaus
More information about the Squeak-dev
mailing list
|