June 18, 2013 [Issue 9975] pointsTo asserts because of false pointer in union | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9975 --- Comment #10 from Martin Nowak <code@dawg.eu> 2013-06-18 03:09:48 PDT --- (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"])(); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 18, 2013 [Issue 9975] pointsTo asserts because of false pointer in union | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9975 --- Comment #11 from monarchdodra@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: ------- |
June 18, 2013 [Issue 9975] pointsTo asserts because of false pointer in union | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9975 Martin Nowak <code@dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrei@erdani.com --- Comment #12 from Martin Nowak <code@dawg.eu> 2013-06-18 10:14:48 PDT --- (In reply to comment #11) > > 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" ? > OK, it's a bit longer. And yes it might fail in swap. auto result = get("http://example.com").parseJSON.array.sort!((a, b) => a["id"].uinteger < b["id"].uinteger)(); I added Andrei to the CC list, maybe he has a good idea how to solve this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
June 18, 2013 [Issue 9975] pointsTo asserts because of false pointer in union | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9975 --- Comment #13 from monarchdodra@gmail.com 2013-06-18 11:21:51 PDT --- (In reply to comment #12) > OK, it's a bit longer. And yes it might fail in swap. > > auto result = get("http://example.com").parseJSON.array.sort!((a, b) => > a["id"].uinteger < b["id"].uinteger)(); > > I added Andrei to the CC list, maybe he has a good idea how to solve this. I just thought of another problem (which is in the original message): While we might be able to special case named unions, we can't for anonymous unions. This means that what we have right now (unless I'm missing information), is the best we can do. I'm really just wondering what business swap has asserting if there are pointers to either of the members... Having such a pointer is a *sign* of stink, but I don't think it is 100% certifiably wrong... in which case it should not assert. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 05, 2013 [Issue 9975] pointsTo asserts because of false pointer in union | ||||
---|---|---|---|---|
| ||||
Posted in reply to Martin Nowak | http://d.puremagic.com/issues/show_bug.cgi?id=9975 --- Comment #14 from monarchdodra@gmail.com 2013-07-05 05:57:29 PDT --- (In reply to comment #13) > I'm really just wondering what business swap has asserting if there are pointers to either of the members... Having such a pointer is a *sign* of stink, but I don't think it is 100% certifiably wrong... in which case it should not assert. Done: https://github.com/D-Programming-Language/phobos/pull/1390 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation