<div dir="ltr">Hi.<div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 25, 2018 at 3:23 PM, Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Sun, 25 Mar 2018, Chris Cunningham wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
On Mar 25, 2018 2:46 PM, "Levente Uzonyi" <<a href="mailto:leves@caesar.elte.hu" target="_blank">leves@caesar.elte.hu</a>> wrote:<br>
      On Sun, 25 Mar 2018, <a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a> wrote:<br>
<br>
            Chris Cunningham uploaded a new version of Kernel to project The Trunk:<br>
            <a href="http://source.squeak.org/trunk/Kernel-cbc.1163.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/trunk<wbr>/Kernel-cbc.1163.mcz</a><br>
<br>
            ==================== Summary ====================<br>
<br>
            Name: Kernel-cbc.1163<br>
            Author: cbc<br>
            Time: 21 March 2018, 9:09:20.773568 pm<br>
            UUID: 45d9dad8-7c81-034e-b578-b9ccd2<wbr>91cab6<br>
            Ancestors: Kernel-dtl.1162, Kernel-fn.1152<br>
<br>
            Update #xor: to work with argument being a block as well.<br>
<br>
            =============== Diff against Kernel-dtl.1162 ===============<br>
<br>
            Item was added:<br>
            + ----- Method: Boolean>>xor: (in category 'logical operations') -----<br>
            + xor: aBoolean +       "Exclusive OR. Answer true if the receiver is not equivalent to aBoolean."<br>
            + +     ^(self == aBoolean) not!<br>
<br>
<br>
Why not just<br>
<br>
        ^self ~~ aBoolean<br>
<br>
Because that lets you xor between Boolean and other a<br>
Odd stuff. Meaning bugs can creep in without any errors being raised. <br>
</blockquote>
<br></span>
Am I missing something? Is there a case when [a~~b] and [(a==b)not] yield different results where a and b can be any object?<br>
<br></blockquote><div>You are not missing anything - I misunderstood your question the first time around (which is why my response was garbage - at least, this time why).</div><div><br></div><div>Yes, that could be fixed, and would provide a clue as to an alternative fast version.</div><div><br></div><div>However, I wonder what a right fix would be?  The subclasses now make sure the arguments equate to a boolean - and it would be weird to have the super class not care about that.  On the other hand, having the super class use ~~ would give the pointer of how to make it really fast - and a more generic explanation.  Hmm.</div><div><br></div><div>Maybe I could switch it around, and add a few comments about how this isn't 'safe' but is fast, and also take the opportunity to make better variable names in the subclasses.</div><div><br></div><div>-cbc </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Also, this method is overridden in all subclasses, isn't it?<span class=""><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Yes ~~ is faster - but xor: is already fast. <br>
</blockquote>
<br></span>
It's not about speed. It's about unnecessary complexity.<span class="HOEnZb"><font color="#888888"><br>
<br>
Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
      ?<br>
<br>
<br>
            Item was changed:<br>
             ----- Method: False>>xor: (in category 'logical operations') -----<br>
             xor: aBoolean<br>
            +       "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)."<br>
            +       ^aBoolean value ifTrue: [ true ] ifFalse: [ false ]!<br>
<br>
<br>
I think the parameter should have a better name, because the #value send doesn't make much sense when you read the code.<br>
<br>
I guess so. <br>
<br>
      Levente<br>
<br>
            -       "Posted by Eliot Miranda to squeak-dev on 3/24/2009"<br>
            - -     ^aBoolean!<br>
<br>
            Item was changed:<br>
             ----- Method: True>>xor: (in category 'logical operations') -----<br>
             xor: aBoolean<br>
            +       "aBoolean is either a boolean, or an object who's #value returns a boolean (usually a block)."<br>
            +       ^aBoolean value ifTrue: [ false ] ifFalse: [ true ]!<br>
            -       "Posted by Eliot Miranda to squeak-dev on 3/24/2009"<br>
            - -     ^aBoolean not!<br>
<br>
<br>
<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br></div></div>