Issue 3270 in pharo: fix xor: to work with blocks and booleans

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 3270 in pharo: fix xor: to work with blocks and booleans

pharo
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


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3270 in pharo: fix xor: to work with blocks and booleans

pharo
Updates:
        Status: Closed

Comment #1 on issue 3270 by marcus.denker: fix xor: to work with blocks and  
booleans
http://code.google.com/p/pharo/issues/detail?id=3270

12250


Reply | Threaded
Open this post in threaded view
|

Re: Issue 3270 in pharo: fix xor: to work with blocks and booleans

Peter van Rooijen
In reply to this post by pharo
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, <[hidden email]> 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
>

Reply | Threaded
Open this post in threaded view
|

Re: Issue 3270 in pharo: fix xor: to work with blocks and booleans

Peter Hugosson-Miller
+1

--
Cheers,
Peter

On Mon, Nov 29, 2010 at 10:49 AM, Peter van Rooijen <[hidden email]> 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, <[hidden email]> 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