[squeak-dev] [bug] xor: is this an old bug or what?

Bert Freudenberg bert at freudenbergs.de
Tue Mar 24 10:30:32 UTC 2009


On 24.03.2009, at 04:10, Keith Hodges wrote:

> Kazuhiro ABE wrote:
>> Hi, Keith,
>> Boolean>>xor: requires a Boolean as a parameter, not a BlockContext.
>> See the definition of xor:.
>>
>> Kazuhiro Abe
>>
>> 2009/3/24 Keith Hodges <keith_hodges at yahoo.co.uk>:
>>
>>> true xor: [ true ]  => true
>>>
>>> discuss
>>>
>>> Keith
> I think that the following would be more consistent.
>
> xor: aBoolean
>
>    ^(self == aBoolean value) not

This even looks suspicious. #value is not a Boolean protocol.

> I was quite pleased to find an application for xor: my first in 15  
> years
> of Smalltalking.


It is rather rarely used indeed. So IMHO adding a guard that makes  
sure aBoolean is, in fact, a Boolean, would alert the occasional user  
to the fact that #xor: has no short-circuiting logic. Besides, #xor:  
is defined in the ANSI standard so we should not water down its  
meaning willy-nilly, for compatibility with other Smalltalks.

- Bert -





More information about the Squeak-dev mailing list