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

Stéphane Rollandin lecteur at zogotounga.net
Sat Dec 5 22:08:21 UTC 2009


> yes, yes.  But real Smalltalk programs have to interface with external 
> programming languages, typically through a C-inlfuenced ABI.  In that 
> context it makes sense.  I second Bert's proposal,  true asInteger == 1 
> and: [false asInteger == 0].

why not use a brand new selector ? the purpose of getting 1 or 0 from a 
Boolean has nothing to do with an actual conversion, better it is some 
kind of an encoding, si IMO neither #asBit nor #asInteger are meaningful 
here. #as0or1 would do the job. and you could even implement 
#as0orMinus1 besides if you like.

Stef





More information about the Squeak-dev mailing list