[Seaside-dev] Re: [Seaside Commits] Seaside 3.0: Grease-Pharo-Core-lr.15.mcz

John O'Keefe wembley.instantiations at gmail.com
Wed Mar 31 14:52:03 UTC 2010


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 :-)

John
On Wed, Mar 31, 2010 at 6:31 AM, Paolo Bonzini <bonzini at gnu.org> wrote:

> On 03/31/2010 12:24 PM, Julian Fitzell wrote:
>
>>  >>>    sorted: sortBlock
>>>>> >>>  +       ^ self sortBy: sortBlock!
>>>>> >>>  -       ^ (self sortBy: sortBlock) as: self species!
>>>>>
>>>> >
>>> >  #species of SortedCollection is SortedCollection. Sorting a
>>> >  SortedCollection with a non-default sortBlock, but then the collection
>>> >  is converted to a SortedCollection with a default sort block, what
>>> >  gives the default sorting.
>>> >
>>> >  I don't know if it is correct to remove the #as: and what was its
>>> >  intention? It doesn't break any tests though, so I guess it is fine.
>>> >  Alternatively we could implement the method in SortedCollection like
>>> >  this.
>>>
>> I think the tests are not thorough enough then, though I thought I had
>> tests for the class of the returned object (maybe we removed them
>> because they were failing?). But it does seem like #sorted:, which
>> returns a copy, should be returning an instance of #species (certainly
>> this is necessary for classes like Interval, which has a species of
>> Array).
>>
>
> Wouldn't that be  ^(self as: self species) sortBy: sortBlock?
>
> Paolo
>
> _______________________________________________
> seaside-dev mailing list
> seaside-dev at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/seaside-dev
>



-- 
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside-dev/attachments/20100331/e24a3504/attachment.htm


More information about the seaside-dev mailing list