[squeak-dev] How to tell if you have a boolean when you care to know

Jerome Peace peace_the_dreamer at yahoo.com
Wed Mar 25 06:08:58 UTC 2009



In another tread Keith Hodges wrote:

2009/3/24 Keith Hodges <keith_hodges at yahoo.co.uk>

> true xor: [ true ]  => true
>
> discuss
>
> Keith

a simple guard for a boolean can be written simply.

true xor: bar aBoolean

will throw an error when bar is not a boolean

if 
Boolean>>aBoolean
^self
and all other classes agree not to implement aBoolean,

This pattern can be extended to do all sorts of dynamic type checking.

Keith: Great bug find says Puck.

Elliot: +1 for your proposed fix for #xor:

Yours in curiosity and service, --Jerome Peace

and his imaginative friend Puck, fearless bug finder and Trouble Maker.




      



More information about the Squeak-dev mailing list