[squeak-dev] [bug] xor: is this an old bug or what?
Nicolas Cellier
nicolas.cellier.aka.nice at gmail.com
Tue Mar 24 01:32:38 UTC 2009
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...
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
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....
Nicolas
2009/3/24 Keith Hodges <keith_hodges at yahoo.co.uk>
> true xor: [ true ] => true
>
> discuss
>
> Keith
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20090324/21da7066/attachment.htm
More information about the Squeak-dev
mailing list
|