[Pharo-dev] aSortedCollection collect: returns OrderedCollection instead of original sorted

Gabriel Cotelli g.cotelli at gmail.com
Mon Jun 19 08:14:58 EDT 2017


You can do anything in the collect block, so the returned objects possibly
cannot be sorted, and even if it can be sorted maybe the sort block is not
compatible.

On Mon, Jun 19, 2017 at 6:04 AM, Denis Kudriashov <dionisiydk at gmail.com>
wrote:

> Hi.
>
> I just found that
>
>
> #() asSortedCollection select: [  ] => SortedCollection
> #() asSortedCollection collect: [  ] => OrderedCollection
>
>
> It feels like a bug to me. But maybe there is a reason why sorted
> collection collects items as OrderedCollection instead of original kind of
> sort?
>
> My usercase was copy of object with sorted collection inside. For this I
> just manually collect copy of each item. But at the end my copy became
> broken because of sort was important for domain logic.
>
> Best regards,
> Denis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20170619/7512766d/attachment-0002.html>


More information about the Pharo-dev mailing list