I disagree.  size implemented in terms of do: is quite appropriate.  The subclass responsibility is do:.  If this doesn&#39;t suit SequenceableCollection then size should be implemented as a subclass responsibility in SequenceableCollection, /not/ in Collection.<br>
<br><div class="gmail_quote">On Fri, Sep 30, 2011 at 1:12 PM,  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
A new version of Collections was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Collections-nice.423.mcz" target="_blank">http://source.squeak.org/inbox/Collections-nice.423.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Collections-nice.423<br>
Author: nice<br>
Time: 30 September 2011, 10:12:20.333 pm<br>
UUID: 7613573f-6d08-9d4c-9d9e-2eaacff799fe<br>
Ancestors: Collections-ul.422<br>
<br>
#size and #do: default implementation will cause an infinite loop in every new subclass of SequenceableCollection without any form of warning to the poor programmer.<br>
<br>
It&#39;s simple to avoid this bad behavior by:<br>
- moving Collection&gt;&gt;size implementation to the sole place where it is used (LinkedList)<br>
- replacing it with a subclassResponsibility.<br>
<br>
=============== Diff against Collections-ul.422 ===============<br>
<br>
Item was changed:<br>
  ----- Method: Collection&gt;&gt;size (in category &#39;accessing&#39;) -----<br>
  size<br>
        &quot;Answer how many elements the receiver contains.&quot;<br>
<br>
+       ^self subclassResponsibility!<br>
-       | tally |<br>
-       tally := 0.<br>
-       self do: [:each | tally := tally + 1].<br>
-       ^ tally!<br>
<br>
Item was added:<br>
+ ----- Method: LinkedList&gt;&gt;size (in category &#39;accessing&#39;) -----<br>
+ size<br>
+       &quot;Answer how many elements the receiver contains.&quot;<br>
+<br>
+       | tally |<br>
+       tally := 0.<br>
+       self do: [:each | tally := tally + 1].<br>
+       ^ tally!<br>
<br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div><br>