<br><br><div class="gmail_quote">On Sat, Dec 5, 2009 at 11:18 AM, David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Sat, Dec 05, 2009 at 02:48:21PM +0100, Bert Freudenberg wrote:<br>
&gt; On 05.12.2009, at 14:29, Randal L. Schwartz wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt;&gt;&gt;&gt;&gt; &quot;Bert&quot; == Bert Freudenberg &lt;<a href="mailto:bert@freudenbergs.de">bert@freudenbergs.de</a>&gt; writes:<br>
&gt; &gt;<br>
&gt; &gt; Bert&gt; I don&#39;t think it would break any sane application. #asInteger is<br>
&gt; &gt; Bert&gt; descriptive, and &quot;feels right&quot; to me. Reading &quot;asBit&quot; I&#39;d expect it to<br>
&gt; &gt; Bert&gt; return an instance of Bit.<br>
&gt; &gt;<br>
&gt; &gt; Bert&gt; I have not really felt the need for such a method, but I can see how<br>
&gt; &gt; Bert&gt; it&#39;s tempting to have, in particular when porting code.<br>
&gt; &gt;<br>
&gt; &gt; It&#39;s also &quot;according to who&quot;.  0 as false, 1 as true is only one encoding,<br>
&gt; &gt; and clearly not universal.  I&#39;ve worked with systems where 0 is false,<br>
&gt; &gt; and -1 is true.<br>
&gt;<br>
&gt; I knew someone would bring this up ;) I also like to KISS.<br>
&gt;<br>
&gt; This is not about internal representation, but about doing arithmetic with<br>
&gt; booleans. I don&#39;t think any other mapping than &quot;true asInteger = 1&quot; and<br>
&gt; &quot;false asInteger = 0&quot; makes sense in that context.<br>
<br>
</div>I don&#39;t think that arithmetic with booleans makes sense in any context.<br>
<br>
Is this convenience method really worth muddying up the distinction between<br>
numbers and booleans? Think of all the C programmers with bad habits<br>
(like me for example) who have had to stop and think twice about assuming<br>
that a number means the same thing as true or false.<br>
<br>
It seems to me that maintaining a clear distinction between numbers and<br>
booleans is a Good Idea even if it does require some extra typing.<br></blockquote><div><br></div><div>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&#39;s proposal,  true asInteger == 1 and: [false asInteger == 0].</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
$0.02<br>
<br>
Dave<br>
<br>
<br>
</blockquote></div><br>