<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 26 October 2016 at 09:35, Bert Freudenberg <span dir="ltr">&lt;<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Oct 26, 2016 at 6:42 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I agreed that it looked good in the ivory tower.  The thing is, there<br>
are these real-world detractors which we should not igore.  To save my<br>
old fingers, let me just summarize them from the earlier posts.  In<br>
summary:<br>
<br>
  - it provides no known material benefit<br></blockquote><div><br></div></span><div>Having an O(1) runtime vs O(n) is a very large material benefit. Collection&gt;&gt;size is O(n) so it&#39;s not a good base for #isEmpty.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  - it could affect unsuspecting legacy application performance<br>
materially, and in an insidious way<br></blockquote><div><br></div></span><div>If you have performance problems, profile.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  - it&#39;s an anomalous usage of the API which works against performance<br>
expectations about #size and #do:.<br></blockquote><div><br></div></span><div>The performance expectation of both #size and #do: in Collection is O(n). And there is nothing &quot;anomalous&quot; in using #do:, quite to the contrary, #do: is the *essence* of a collection of objects.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  - the justification for this change (performance optimization) in<br>
Collection is not valid in the first place.<br></blockquote><div><br></div></span><div>It is very valid optimization given the implementation of Collection&gt;&gt;size.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">No real-world positives, just negatives or zeros.  Please revert.<br></blockquote><div> </div></span></div>Quite the opposite. It&#39;s a major improvement in basic API.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Yes, you will have to provide an optimized #isEmpty now, because you relied on an implementation detail of a superclass.  But there never was a contract that #isEmpty needs to be implemented in terms of #size. The new implementation makes much more sense for an arbitrary abstract Collection, so I&#39;d like to see it stay.</div></div></blockquote><div><br></div><div>+1. Especially since we&#39;ve seen examples of Collections where #size just doesn&#39;t make sense: generators, Actor-style mailboxes, Xtreams (and, by extension, all reactive APIs).</div><div><br></div><div>Which is exactly why in C# an IEnumerable (a Collection) doesn&#39;t even have a Count method. (It&#39;s added as an extension, and People Know(tm) to be careful using it on an abstract collection.)</div><div><br></div><div>Really, to be properly Ivory Tower, and Elegant, Collection&#39;s #size should be removed. And as Eliot correctly points out, the only elegant way to ask a Collection about which you know nothing, whether it has any elements, is to _evaluate its first value_.</div><div><br></div><div>I can&#39;t give real world Smalltalk experience reports, but I can say, with many burn marks to prove it, that asking an abstract collection of things for its size, is a terrible idea.</div><div><br></div><div>frank</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="HOEnZb"><font color="#888888"><div class="gmail_extra">- Bert -</div><div class="gmail_extra"><br></div></font></span></div>
<br><br>
<br></blockquote></div><br></div></div>