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

Juan Vuletich juan at jvuletich.org
Tue Mar 24 12:23:10 UTC 2009


Nicolas Cellier wrote:
> 1) #xor: should not take a block as argument.
> Rationale:
> - the block would ALWAYS have to be evaluated
> - block arguments are either for repeated evaluation, or condiitonal 
> evaluation...
> This is not the case here, so the need of a block argument vanishes...
>
True!

> 2) #xor: argument should be a Boolean, but here no guard is made.
>
> We could eventually add:
>    aBoolean isBoolean ifFalse; [self error: 'xor must take a boolean 
> as argument']
>
> Or if we want to later extend to some other class:
> True>>xor: aBoolean
>     ^aBoolean xorTrue
> False>>xor: aBoolean
>     ^aBoolean xorFalse
> True>>xorTrue
>     ^false
> True>>xorFalse
>     ^self
> False>>xorTrue
>     ^true
> False>>xorFalse
>     ^self

Beautiful!
>
> MySymbolicBooleanClass>>xorTrue
>     ^SymbolicXorOperation with: self with: true
>
> I'm not sure whether we need to protect or not...
> I tend to avoid over-protecting code. As long as a debugger opens, I 
> claim protecting is void...
> But here, I don't like a false program proceeding without a Notifier....
>
Agreed.

> Nicolas
>
Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list