[squeak-dev] Protocol extension proposal: Boolean>>asBit ?

Randal L. Schwartz merlyn at stonehenge.com
Sat Dec 5 13:29:52 UTC 2009


>>>>> "Bert" == Bert Freudenberg <bert at freudenbergs.de> writes:

Bert> I don't think it would break any sane application. #asInteger is
Bert> descriptive, and "feels right" to me. Reading "asBit" I'd expect it to
Bert> return an instance of Bit.

Bert> I have not really felt the need for such a method, but I can see how
Bert> it's tempting to have, in particular when porting code.

It's also "according to who".  0 as false, 1 as true is only one encoding,
and clearly not universal.  I've worked with systems where 0 is false,
and -1 is true.

I think this should be treated like an encoding, with the knowledge
documented there:

  (Boolean instance) as: EncodedBooleanInteger

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion



More information about the Squeak-dev mailing list