[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squeak-dev
Subject:    Re: [squeak-dev] The Inbox: Kernel-cbc.1164.mcz
From:       Eliot Miranda <eliot.miranda () gmail ! com>
Date:       2018-03-27 18:58:53
Message-ID: CAC20JE19OO+TdDFFM2cKtdAUtN_jHiN8E3tOtbgCCWBdmvRYfg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi All,

On Mon, Mar 26, 2018 at 9:22 PM, Chris Muller <asqueaker@gmail.com> wrote:

> I like the better-named arguments, but may we please keep an abstract
> implementation up in Boolean anyway?
>

The problem is that the abstract implementation is wrong.  Here it is:

xor: aBoolean
"Exclusive OR. Answer true if the receiver is not equivalent to aBoolean."

^(self == aBoolean) not

a) it accepts non-booleans
b) it answers true when given a block

I believe what we want is

xor: aBooleanOrBlock
"Exclusive OR. Answer true if the receiver is not equivalent to aBoolean."

^ aBooleanOrBlock value ifTrue: [self not] ifFalse: [self]


I'm happy to commit this if people agree.  But personally I prefer the
subclassResponsibility.  Now, I have some angels dancing somewhere I'd like
to check out...


> Besides being documentative (is that a word?), for a
> semi-controversial change like this, it allows users to easily
> configure back to standard Smalltalk implementation (non
> block-supporting) by merely removing subclass selectors.  No need to
> compile new source..
>
>
>
> On Mon, Mar 26, 2018 at 6:24 PM,  <commits@source.squeak.org> wrote:
> > A new version of Kernel was added to project The Inbox:
> > http://source.squeak.org/inbox/Kernel-cbc.1164.mcz
> >
> > ==================== Summary ====================
> >
> > Name: Kernel-cbc.1164
> > Author: cbc
> > Time: 26 March 2018, 4:24:34.650291 pm
> > UUID: 1db3c61f-3486-5847-bb7b-2e3409818f92
> > Ancestors: Kernel-cbc.1163
> >
> > Removed implementation from Boolean>>xor: (made it sublcass
> responsibility).
> > Chose a better method argument name for #xor:
> >
> > =============== Diff against Kernel-cbc.1163 ===============
> >
> > Item was changed:
> >   ----- Method: Boolean>>xor: (in category 'logical operations') -----
> > + xor: aBooleanOrBlock
> > +       "Exclusive OR. Answer true if self is not equivalent to
> aBooleanOrBlock.
> > +       aBooleanOrBlock is either a boolean, or evaluates to a boolean."
> > - xor: aBoolean
> > -       "Exclusive OR. Answer true if the receiver is not equivalent to
> aBoolean."
> >
> > +       ^self subclassResponsibility!
> > -       ^(self == aBoolean) not!
> >
> > Item was changed:
> >   ----- Method: False>>xor: (in category 'logical operations') -----
> > + xor: aBooleanOrBlock
> > +       "aBooleanOrBlock is either a boolean, or an object who's #value
> returns a boolean (usually a block)."
> > +       ^aBooleanOrBlock value ifTrue: [ true ] ifFalse: [ false ]!
> > - xor: aBoolean
> > -       "aBoolean is either a boolean, or an object who's #value returns
> a boolean (usually a block)."
> > -       ^aBoolean value ifTrue: [ true ] ifFalse: [ false ]!
> >
> > Item was changed:
> >   ----- Method: True>>xor: (in category 'logical operations') -----
> > + xor: aBooleanOrBlock
> > +       "aBooleanOrBlock is either a boolean, or an object who's #value
> returns a boolean (usually a block)."
> > +       ^aBooleanOrBlock value ifTrue: [ false ] ifFalse: [ true ]!
> > - xor: aBoolean
> > -       "aBoolean is either a boolean, or an object who's #value returns
> a boolean (usually a block)."
> > -       ^aBoolean value ifTrue: [ false ] ifFalse: [ true ]!
> >
> >
>
>


-- 
_,,,^..^,,,_
best, Eliot

[Attachment #5 (text/html)]

<div dir="ltr">Hi All,<div class="gmail_extra"><br><div class="gmail_quote">On Mon, \
Mar 26, 2018 at 9:22 PM, Chris Muller <span dir="ltr">&lt;<a \
href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>&gt;</span> \
wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I \
like the better-named arguments, but may we please keep an abstract<br> \
implementation up in Boolean anyway?<br></blockquote><div><br></div><div>The problem \
is that the abstract implementation is wrong.   Here it \
is:</div><div><br></div><div>xor: aBoolean  </div><div><span \
class="gmail-Apple-tab-span" style="white-space:pre">	</span>&quot;Exclusive OR. \
Answer true if the receiver is not equivalent to \
aBoolean.&quot;</div><div><br></div><div><span class="gmail-Apple-tab-span" \
style="white-space:pre">	</span>^(self == aBoolean) not  </div><div><br></div><div>a) \
it accepts non-booleans</div><div>b) it answers true when given a \
block</div><div><br></div><div>I believe what we want \
is</div><div><br></div><div><div>xor: aBooleanOrBlock</div><div><span \
class="gmail-Apple-tab-span" style="white-space:pre">	</span>&quot;Exclusive OR. \
Answer true if the receiver is not equivalent to \
aBoolean.&quot;</div><div><br></div><div><span class="gmail-Apple-tab-span" \
style="white-space:pre">	</span>^ aBooleanOrBlock value ifTrue: [self not] ifFalse: \
[self]</div></div><div><br></div><div><br></div><div>I&#39;m happy to commit this if \
people agree.   But personally I prefer the subclassResponsibility.   Now, I have \
some angels dancing somewhere I&#39;d like to check \
out...</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
 <br>
Besides being documentative (is that a word?), for a<br>
semi-controversial change like this, it allows users to easily<br>
configure back to standard Smalltalk implementation (non<br>
block-supporting) by merely removing subclass selectors.   No need to<br>
compile new source..<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
<br>
On Mon, Mar 26, 2018 at 6:24 PM,   &lt;<a \
href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt; wrote:<br> \
&gt; A new version of Kernel was added to project The Inbox:<br> &gt; <a \
href="http://source.squeak.org/inbox/Kernel-cbc.1164.mcz" rel="noreferrer" \
target="_blank">http://source.squeak.org/<wbr>inbox/Kernel-cbc.1164.mcz</a><br> \
&gt;<br> &gt; ==================== Summary ====================<br>
&gt;<br>
&gt; Name: Kernel-cbc.1164<br>
&gt; Author: cbc<br>
&gt; Time: 26 March 2018, 4:24:34.650291 pm<br>
&gt; UUID: 1db3c61f-3486-5847-bb7b-<wbr>2e3409818f92<br>
&gt; Ancestors: Kernel-cbc.1163<br>
&gt;<br>
&gt; Removed implementation from Boolean&gt;&gt;xor: (made it sublcass \
responsibility).<br> &gt; Chose a better method argument name for #xor:<br>
&gt;<br>
&gt; =============== Diff against Kernel-cbc.1163 ===============<br>
&gt;<br>
&gt; Item was changed:<br>
&gt;     ----- Method: Boolean&gt;&gt;xor: (in category &#39;logical operations&#39;) \
-----<br> &gt; + xor: aBooleanOrBlock<br>
&gt; +           &quot;Exclusive OR. Answer true if self is not equivalent to \
aBooleanOrBlock.<br> &gt; +           aBooleanOrBlock is either a boolean, or \
evaluates to a boolean.&quot;<br> &gt; - xor: aBoolean<br>
&gt; -           &quot;Exclusive OR. Answer true if the receiver is not equivalent to \
aBoolean.&quot;<br> &gt;<br>
&gt; +           ^self subclassResponsibility!<br>
&gt; -           ^(self == aBoolean) not!<br>
&gt;<br>
&gt; Item was changed:<br>
&gt;     ----- Method: False&gt;&gt;xor: (in category &#39;logical operations&#39;) \
-----<br> &gt; + xor: aBooleanOrBlock<br>
&gt; +           &quot;aBooleanOrBlock is either a boolean, or an object who&#39;s \
#value returns a boolean (usually a block).&quot;<br> &gt; +           \
^aBooleanOrBlock value ifTrue: [ true ] ifFalse: [ false ]!<br> &gt; - xor: \
aBoolean<br> &gt; -           &quot;aBoolean is either a boolean, or an object \
who&#39;s #value returns a boolean (usually a block).&quot;<br> &gt; -           \
^aBoolean value ifTrue: [ true ] ifFalse: [ false ]!<br> &gt;<br>
&gt; Item was changed:<br>
&gt;     ----- Method: True&gt;&gt;xor: (in category &#39;logical operations&#39;) \
-----<br> &gt; + xor: aBooleanOrBlock<br>
&gt; +           &quot;aBooleanOrBlock is either a boolean, or an object who&#39;s \
#value returns a boolean (usually a block).&quot;<br> &gt; +           \
^aBooleanOrBlock value ifTrue: [ false ] ifFalse: [ true ]!<br> &gt; - xor: \
aBoolean<br> &gt; -           &quot;aBoolean is either a boolean, or an object \
who&#39;s #value returns a boolean (usually a block).&quot;<br> &gt; -           \
^aBoolean value ifTrue: [ false ] ifFalse: [ true ]!<br> &gt;<br>
&gt;<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div \
class="gmail_signature"><div dir="ltr"><div><span \
style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, \
Eliot</div></span></div></div></div> </div></div>


[Attachment #6 (text/plain)]




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic