<div>I believe Paolo is correct. #sort: is supposed to return the receiver sorted in-place while #sorted: is supposed to return a sorted copy of the receiver. A comment to this effect would be nice also :-)</div>
<div> </div>
<div>John<br></div>
<div class="gmail_quote">On Wed, Mar 31, 2010 at 6:31 AM, Paolo Bonzini <span dir="ltr"><<a href="mailto:bonzini@gnu.org">bonzini@gnu.org</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<div class="im">On 03/31/2010 12:24 PM, Julian Fitzell wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">>>> sorted: sortBlock<br>>>> + ^ self sortBy: sortBlock!<br>>>> - ^ (self sortBy: sortBlock) as: self species!<br>
</blockquote></blockquote>><br>> #species of SortedCollection is SortedCollection. Sorting a<br>> SortedCollection with a non-default sortBlock, but then the collection<br>> is converted to a SortedCollection with a default sort block, what<br>
> gives the default sorting.<br>><br>> I don't know if it is correct to remove the #as: and what was its<br>> intention? It doesn't break any tests though, so I guess it is fine.<br>> Alternatively we could implement the method in SortedCollection like<br>
> this.<br></blockquote>I think the tests are not thorough enough then, though I thought I had<br>tests for the class of the returned object (maybe we removed them<br>because they were failing?). But it does seem like #sorted:, which<br>
returns a copy, should be returning an instance of #species (certainly<br>this is necessary for classes like Interval, which has a species of<br>Array).<br></blockquote><br></div>Wouldn't that be ^(self as: self species) sortBy: sortBlock?<br>
<font color="#888888"><br>Paolo</font>
<div>
<div></div>
<div class="h5"><br>_______________________________________________<br>seaside-dev mailing list<br><a href="mailto:seaside-dev@lists.squeakfoundation.org" target="_blank">seaside-dev@lists.squeakfoundation.org</a><br><a href="http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev" target="_blank">http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.<br>