[squeak-dev] Bug in SortedCollection

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[squeak-dev] Bug in SortedCollection

Ricardo Moran
Hi, today I found this:

a := Object new -> 1.
b := Object new -> 2.
c := Object new -> 3.
d := Object new -> 4.

ss := {a. b. c.} asSortedCollection: [:a :b | a value < b value].

So far, it evaluates nicely, but when I try to do the following

ss , {d}

I get: Object doesNotUnderstand: <

Perhaps this is something you don't usually do with SortedCollections but I don't know. I believe the problem is that OrderedCollection's implementation of #copyReplaceFrom:to:with: creates a new collection without passing it the sortBlock. It can be easily fixed by overriding this method in SortedCollection and duplicating the code but I think it's ugly.
What do you think?



Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Bug in SortedCollection

Nicolas Cellier
2009/7/28 Ricardo Moran <[hidden email]>:

> Hi, today I found this:
>
> a := Object new -> 1.
> b := Object new -> 2.
> c := Object new -> 3.
> d := Object new -> 4.
>
> ss := {a. b. c.} asSortedCollection: [:a :b | a value < b value].
>
> So far, it evaluates nicely, but when I try to do the following
>
> ss , {d}
>
> I get: Object doesNotUnderstand: <
> Perhaps this is something you don't usually do with SortedCollections but I
> don't know. I believe the problem is that OrderedCollection's implementation
> of #copyReplaceFrom:to:with: creates a new collection without passing it the
> sortBlock. It can be easily fixed by overriding this method in
> SortedCollection and duplicating the code but I think it's ugly.
> What do you think?
>
>

I think you got it right and this is a known bug
http://bugs.squeak.org/view.php?id=6535
The fix cannot be loaded automatically because the ordre of changes
matters and I did not care enough of it...
But you can load the changes in a ChangeList thru the FIleBrowser and
manually file in change by change in the interim if you are
interested.

Nicolas

>
>

Reply | Threaded
Open this post in threaded view
|

Re: [squeak-dev] Bug in SortedCollection

Ricardo Moran
Thanks! I will try that


On Tue, Jul 28, 2009 at 6:14 PM, Nicolas Cellier <[hidden email]> wrote:
2009/7/28 Ricardo Moran <[hidden email]>:
> Hi, today I found this:
>
> a := Object new -> 1.
> b := Object new -> 2.
> c := Object new -> 3.
> d := Object new -> 4.
>
> ss := {a. b. c.} asSortedCollection: [:a :b | a value < b value].
>
> So far, it evaluates nicely, but when I try to do the following
>
> ss , {d}
>
> I get: Object doesNotUnderstand: <
> Perhaps this is something you don't usually do with SortedCollections but I
> don't know. I believe the problem is that OrderedCollection's implementation
> of #copyReplaceFrom:to:with: creates a new collection without passing it the
> sortBlock. It can be easily fixed by overriding this method in
> SortedCollection and duplicating the code but I think it's ugly.
> What do you think?
>
>

I think you got it right and this is a known bug
http://bugs.squeak.org/view.php?id=6535
The fix cannot be loaded automatically because the ordre of changes
matters and I did not care enough of it...
But you can load the changes in a ChangeList thru the FIleBrowser and
manually file in change by change in the interim if you are
interested.

Nicolas

>
>