[Issue 9975] pointsTo asserts because of false pointer in union

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 18 07:40:41 PDT 2013


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



--- Comment #11 from monarchdodra at gmail.com 2013-06-18 07:40:38 PDT ---
(In reply to comment #10)
> (In reply to comment #9)
> > It *is* a problem, but I don't think it is as big a problem as you think it is
> > (or at least, not in your wording of "sort can't be used with structs").
> > 
> 
> These kind of things just have to work.
> 
> auto result = get("http://example.com").parseJSON().sort!((a, b) => a["id"] <
> b["id"])();

That didn't compile for me, but I suppose it's supposed to assert in "swap" ?

In any case, I'm not sure how to go about fixing this, it's either false
negatives, or false positives.

I looked into doing a tri-state answer, à la boost::tribool, however, this does
not work in D at all (due to overloads being implemented in terms of others):
(a != b) => !(a == b)
(!a)     => !cast(bool)a

Maybe an extra parameter, eg "enums = {falsePositive, falseNegative}" could
work?

Or maybe we should just say that "pointsTo" is mostly only ever used in
asserts, so prefers false negatives?

I'll look into what I can provide...

-- 
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