[Issue 10318] Built-in array sort usage warning, then deprecation, and finally removal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 27 10:49:35 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=10318



--- Comment #7 from Xinok <xinok at live.com> 2013-12-27 10:49:26 PST ---
(In reply to comment #6)
> (In reply to comment #5)
> 
> > This issue has been fixed and pushed to the 2.065 branch.
> 
> Good.
> You are probably well qualified to answer yebblies question: Is currently the
> phobos sort good enough to replace the built-in sort? So is it OK to finally
> warn against the usage of the built-in sort?

AFAIK, these two issues remain:

(1) You cannot call Phobos sort from pure functions. I'm not familiar with the
subject of purity, but AFAIK, you can't simply mark the function(s) as pure
because this would make it impossible to use an impure predicate for sorting.
I'm not sure what the solution is as I don't think it's possible to simply
infer purity.

(2) This may be a non-issue but Phobos cannot sort char[] arrays whereas the
built-in sort can. The issue comes down to the template constraints; char[]
isn't classified as a random-access range and neither is wchar[]. However,
dchar[] is classified as such and can be sorted by Phobos sort.

At this point, I'm in favor of warning against its usage. The Phobos sort is
"free of bugs" (I've found no cases where it sorts incorrectly), runs in O(n
log n) time, and is highly optimized (3-4x faster than the built-in sort).
However, I think the purity issue needs to be addressed before we move forward
with deprecation.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list