[Pharo-project] Issue 3270 in pharo: fix xor: to work with blocks and booleans

Peter Hugosson-Miller oldmanlink at gmail.com
Mon Nov 29 04:54:00 EST 2010


+1

-- 
Cheers,
Peter

On Mon, Nov 29, 2010 at 10:49 AM, Peter van Rooijen <peter at vanrooijen.com>wrote:

> Hi,
>
> I don't get why it should work with blocks, since evaluation
> of the exclusive OR operation cannot be short-circuited.
> Therefore there is no reason to ever use a block as an argument.
>
> #and: and #or: take a block as an argument precisely because
> for 50% of the receivers (i.e., false and true, respectively)
> it is known in advance that the value of the expression in the
> argument block is irrelevant, so it would be at least wasteful
> to evaluate it.
>
> But this reasoning does not apply to #xor:.
>
> I think it is simply a user mistake when a block is provided
> as argument, where a boolean is required.
>
> It's an understandable mistake (that I've made myself ;) since xor:
> has such similarities to or: that you automatically want to start
> a block unless you're really thinking about what you're doing.
>
> So, I don't see the bug. Thus, I don't see the fix. I do see
> obscure code (aBoolean value)and wasted time because of the
> extra message send.
>
> Apologies if this is a late response, I unly just saw the issue mentioned.
>
> Cheers, Peter
>
>
>
> On Thu, 18 Nov 2010 18:55:41 +0100, <pharo at googlecode.com> wrote:
>
>  Status: Fixed
>> Owner: marcus.denker
>> Labels: Milestone-1.2
>>
>> New issue 3270 by marcus.denker: fix xor: to work with blocks and booleans
>> http://code.google.com/p/pharo/issues/detail?id=3270
>>
>> ... so that it works like or: (calling #value on the argument. This means
>> it will continue to work with booleans, too).
>>
>>
>>
>> Attachments:
>>        XOr.1.cs  903 bytes
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20101129/218321fc/attachment-0001.html>


More information about the Pharo-dev mailing list