[Issue 8469] isSorted fails with predicate "a.length < b.length ? true : a < b"

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 30 10:26:12 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8469



--- Comment #5 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-07-30 10:26:10 PDT ---
Hmmm. I didn't realize that the predicate was screwed up, but it does indeed
look like it was badly written (I didn't even think about comparing in both
directions like that - I should have). I guess that I was in too much of a
hurry when I wrote it.

Well, sort gives an assertion failure which is pretty bad in this situation in
that it claims that the sorting didn't work, which looks completely wrong,
since it _did_ work.

I definitely think that it makes the most sense to make isSorted assert on bad
predicates and have it clearly state that predicate was bad because it's
antisymmetric. Then it's clear that the problem is with the predicate and not
sorted or isSorted.

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


More information about the Digitalmars-d-bugs mailing list