Re: a mild sorting annoyance?
Re: a mild sorting annoyance?
- Subject: Re: a mild sorting annoyance?
- From: Ondra Cada <email@hidden>
- Date: Tue, 19 Nov 2002 14:17:37 +0100
On Tuesday, Nov 19, 2002, at 03:53 Europe/Prague, John C. Randolph
wrote:
I wouldn't call it a bug. If you return NSOrderedSame, I'd say it's
fair to insert the two elements in question in either order. It
sounds like in your situation, they're not *really* the same. For the
example you give, your compare method should check both criteria.
It's a bit more subtle. Programmer's POV of course there's no real
difference: you either sort by more keys or not, and save some
(generally negligible) performance gain, stable or non-stable sorting,
all the same.
The advantage of stable sorting algorithm comes from the user's POV:
you don't need to have any GUI for multi-key sorting, and *still* you
can, effectively, do that. Of course again this *can* be achieved
programmatically, but the vast advantage of a stable NSArray sorting
would the that it would just work for any app, regardless its
programmer even considered it or not.
That's why I think a feature request might be a right way (of course, a
bug report would be out of order -- there's no bug, we are speaking of
a possible feature to be added). Also, I am not *that* an expert of
sorting algorithms: although I am quite positive there is a stable
sorting algorithm which won't be slower than anything which is actually
used (qsort?), I might be wrong there.
If there is no stable algorithm quick enough, it might be best if it
was externally settable by a default, something like
com.apple.stableArraySortingAlgorithm NO/YES.
---
Ondra Cada
OCSoftware: email@hidden
http://www.ocs.cz
private email@hidden
http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.