<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p></p>
<div>> That is correct.</div>
<div>> I had a look at #asSimpleGetter and I don't think it should be written as</div>
<div>> you did. Why?</div>
<div>> - String >> #numArgs can return -1, which is not handled by the method</div>
<div>> - String >> #numArgs is not cheap. Using it twice on one of the most</div>
<div>> common paths (the argument is a simple setter) is a waste.</div>
<div>> - It doesn't handle binary selectors, e.g. #~=</div>
<div>> </div>
<div>> I would write something like this:</div>
<div>> </div>
<div>>          self precedence</div>
<div>>                  caseOf: {</div>
<div>>                          [ 1 ] -> [ self numArgs = 0 ifTrue: [ ^self ] ].</div>
<div>>                          [ 3 ] -> [ self numArgs = 1 ifTrue: [ ^self allButLast asSymbol ] ] }</div>
<div>>                  otherwise: [].</div>
<div>>          self error: 'only simple setters and getters can be converted to simple getters'.</div>
<div><br>
</div>
<div>+1, this is a much better implementation :)</div>
<div id="x_Signature">
<div name="x_divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<div><font size="2" color="#808080"></font></div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Von:</b> Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Levente Uzonyi <leves@caesar.elte.hu><br>
<b>Gesendet:</b> Montag, 23. September 2019 17:40:30<br>
<b>An:</b> The general-purpose Squeak developers list<br>
<b>Cc:</b> Squeak Dev<br>
<b>Betreff:</b> Re: [squeak-dev] The Inbox: Collections-ct.853.mcz</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On Mon, 23 Sep 2019, Thiede, Christoph wrote:<br>
<br>
> <br>
> This changeset sounds well, thanks for the link. However, am I wrong or does this changeset *not* provide a way to convert a setter back to a getter, as I proposed?<br>
<br>
That is correct.<br>
I had a look at #asSimpleGetter and I don't think it should be written as <br>
you did. Why?<br>
- String >> #numArgs can return -1, which is not handled by the method<br>
- String >> #numArgs is not cheap. Using it twice on one of the most <br>
common paths (the argument is a simple setter) is a waste. <br>
- It doesn't handle binary selectors, e.g. #~=<br>
<br>
I would write something like this:<br>
<br>
         self precedence<br>
                 caseOf: {<br>
                         [ 1 ] -> [ self numArgs = 0 ifTrue: [ ^self ] ].<br>
                         [ 3 ] -> [ self numArgs = 1 ifTrue: [ ^self allButLast asSymbol ] ] }<br>
                 otherwise: [].<br>
         self error: 'only simple setters and getters can be converted to simple getters'.<br>
<br>
<br>
Levente<br>
<br>
> <br>
> <br>
> Best,<br>
> <br>
> Christoph<br>
> <br>
> __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________<br>
> Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Taeumel, Marcel<br>
> Gesendet: Montag, 23. September 2019 11:31:54<br>
> An: Alan Grimes via Squeak-dev<br>
> Betreff: Re: [squeak-dev] The Inbox: Collections-ct.853.mcz  <br>
> I think we should file-in Patrick's change set about that matter instead: <a href="http://forum.world.st/The-Trunk-Collections-pre-822-mcz-td5097223.html">
http://forum.world.st/The-Trunk-Collections-pre-822-mcz-td5097223.html</a><br>
> <br>
> Best,<br>
> Marcel<br>
><br>
>       Am 22.09.2019 01:52:34 schrieb Levente Uzonyi <leves@caesar.elte.hu>:<br>
><br>
>       On Sat, 21 Sep 2019, Thiede, Christoph wrote:<br>
><br>
>       ><br>
>       > By the way, when moving methods from package A to B, does the order of involved commits matter to you?<br>
><br>
>       The updater should handle that once both versions are in the Trunk, but<br>
>       I'd upload the package with the addition first.<br>
><br>
>       Levente<br>
><br>
>       ><br>
>       >_________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________<br>
>       _<br>
>       > Von: Squeak-dev im Auftrag von commits@source.squeak.org<br>
>       > Gesendet: Samstag, 21. September 2019 19:36:47<br>
>       > An: squeak-dev@lists.squeakfoundation.org<br>
>       > Betreff: [squeak-dev] The Inbox: Collections-ct.853.mcz  <br>
>       > A new version of Collections was added to project The Inbox:<br>
>       > <a href="http://source.squeak.org/inbox/Collections-ct.853.mcz">http://source.squeak.org/inbox/Collections-ct.853.mcz</a><br>
>       ><br>
>       > ==================== Summary ====================<br>
>       ><br>
>       > Name: Collections-ct.853<br>
>       > Author: ct<br>
>       > Time: 21 September 2019, 7:36:40.443935 pm<br>
>       > UUID: 627a4e03-54a2-9245-899e-62e983669d25<br>
>       > Ancestors: Collections-mt.851<br>
>       ><br>
>       > Move #asSimpleSetter from MorphicExtras to Collections (step 2/2) and supplement it by #asSimpleGetter<br>
>       ><br>
>       > Complements MorphicExtras-ct.261<br>
>       ><br>
>       > =============== Diff against Collections-mt.851 ===============<br>
>       ><br>
>       > Item was added:<br>
>       > + ----- Method: Symbol>>asSimpleGetter (in category 'converting') -----<br>
>       > + asSimpleGetter<br>
>       > +<br>
>       > +        self numArgs isZero ifTrue: [^ self].<br>
>       > +        self numArgs > 1 ifTrue: [self error: 'Cannot convert complex selector to getter'].<br>
>       > +        ^ self allButLast asSymbol!<br>
>       ><br>
>       > Item was added:<br>
>       > + ----- Method: Symbol>>asSimpleSetter (in category 'converting') -----<br>
>       > + asSimpleSetter<br>
>       > +        ^ (self, ':') asSymbol!<br>
>       ><br>
>       ><br>
>       ><br>
>       ><br>
> <br>
> <br>
></div>
</span></font>
</body>
</html>