<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 5 sept. 2019 à 23:52, Chris Muller <<a href="mailto:asqueaker@gmail.com">asqueaker@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Thu, Sep 5, 2019 at 3:43 PM Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>IMO, no.</div><div>We don't want to have an empty Matrix by default, it's useless 99% of time.</div></div></blockquote><div><br></div><div>But that's exactly what this commit is about -- having "Matrix new" return a well-formed (empty) Matrix.  Isn't it what we're talking about?</div><div> </div></div></div></blockquote><div>Yes, but the 1% of case when this could be useful should not spoil the 99%.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>So it means initializing twice for nothing 99% of time.</div></div></blockquote><div><br></div><div>"Initializing twice" is something we've accepted as an acceptable trade-off for nice code since 2006, when we changed Behavior>>#new to call #initialize.  </div><div><br></div></div></div></blockquote><div><div>The reason to put initialize in Behavior was to avoid hundreds of duplications of ^self basicNew initialize</div><div>The trade off was to eventually call an empty initialize method for those not needing one</div><div><br></div><div>Most classes take care to not double initialize when using alternate instance creation method.<br></div></div><div>That's why they use basicNew/basicNew:.</div><div>So we can have our cake and eat it too.<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">Wasting does not fit the predominant definition of nice nowadays, at least not mine ;)</div><div class="gmail_quote"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>Via Array empty, we're talking about three measly variable assignments.  Maybe it's just me, but that's light enough to prefer the nicer code.</div><div><br></div><div> - Chris</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>That's exactly where I would put basicNew... </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div> </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le jeu. 5 sept. 2019 à 22:35, Chris Muller <<a href="mailto:asqueaker@gmail.com" target="_blank">asqueaker@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>C'mon guys, it's neither!</div><div><br></div><div>"Different super call" is a classic smell picked up by Lint, and I agree with Tim about "basicNew" -- is an unnecessary use of a low-level method.</div><div><br></div><div>So why not simply the same conventional Smalltalky way, overriding #initialize like everywhere else?</div><div><br></div><div>  initialize</div><div>       super initialize.</div><div>       self rows: 0 columns: 0 contents: Array empty</div><div><br></div><div>And, done..?  </div><div><br></div><div> - Chris</div><div><br></div><div dir="ltr">On Wed, Sep 4, 2019 at 3:38 PM tim Rowledge <<a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On 2019-09-04, at 12:58 PM, Thiede, Christoph <<a href="mailto:Christoph.Thiede@student.hpi.uni-potsdam.de" target="_blank">Christoph.Thiede@student.hpi.uni-potsdam.de</a>> wrote:<br>
> <br>
> Thank you :)<br>
> <br>
> A very minor question: Would you favor [self basicNew] over [super new]? It will work completely equivalently, but what is the better style?<br>
<br>
^super new<br>
<br>
`self basicNew` will not always work equivalently. And I can almost guarantee it will always do the wrong thing just when you feel sure it is doing the right thing. And you will suffer Debugging Hell.<br>
<br>
<br>
tim<br>
--<br>
tim Rowledge; <a href="mailto:tim@rowledge.org" target="_blank">tim@rowledge.org</a>; <a href="http://www.rowledge.org/tim" rel="noreferrer" target="_blank">http://www.rowledge.org/tim</a><br>
Why use one word when two polysyllabic agglomerates will do?<br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div></div>
<br>
</blockquote></div></div>
<br>
</blockquote></div></div>
<br>
</blockquote></div></div>