Thread overview | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
June 16, 2013 [Issue 10381] New: Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10381 Summary: Nonsense associative array comparison Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: wrong-code Severity: critical Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: verylonglogin.reg@gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-06-16 18:29:05 MSD --- Currently associative arrays are compared by comparing its `impl` pointers e.g. `aa1 < aa2` is rewritten as `cast(void*) aa1 > cast(void*) aa2` instead of calling a runtime function. --- void main() { int[int] aa1 = [0: 1]; int[int] aa2 = [0: 1]; assert(aa1 == aa2); // Passes assert(!(aa1 < aa2) && !(aa1 > aa2)); // Fails, different `impl`-s } --- And yes, there is not such function in druntime so this is druntime's issue too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 --- Comment #1 from hsteoh@quickfur.ath.cx 2013-07-08 15:12:06 PDT --- IMO, comparing AA's with < should be a compile-time error. AA's are unordered so it makes no sense to use < to compare them. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 08, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 bearophile_hugs@eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs@eml.cc --- Comment #2 from bearophile_hugs@eml.cc 2013-07-08 15:58:43 PDT --- (In reply to comment #1) > IMO, comparing AA's with < should be a compile-time error. AA's are unordered so it makes no sense to use < to compare them. There are some meaningful (and occasionally useful) operations done on whole associative arrays, like testing if the keys of an associative array are a subset (or strict subset) of the keys of another associative array. But probably it's not the best idea to use < to perform similar set comparisons... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 20, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 --- Comment #3 from Don <clugdbug@yahoo.com.au> 2013-09-19 23:20:27 PDT --- https://github.com/D-Programming-Language/dmd/pull/2575 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 20, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 Martin Nowak <code@dawg.eu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |code@dawg.eu --- Comment #4 from Martin Nowak <code@dawg.eu> 2013-09-20 12:42:36 PDT --- (In reply to comment #2) > There are some meaningful (and occasionally useful) operations done on whole associative arrays, like testing if the keys of an associative array are a subset (or strict subset) of the keys of another associative array. Yes, interesting but too complex/specialized for built-in functionality IMHO. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 20, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 --- Comment #5 from hsteoh@quickfur.ath.cx 2013-09-20 13:31:02 PDT --- (In reply to comment #4) > (In reply to comment #2) > > There are some meaningful (and occasionally useful) operations done on whole associative arrays, like testing if the keys of an associative array are a subset (or strict subset) of the keys of another associative array. > > Yes, interesting but too complex/specialized for built-in functionality IMHO. FWIW, using == on AA's already does (a superset of) what an AA subset operation would do (iterate over AA keys and check for existence in the other AA). But I agree that it shouldn't be built-in functionality. Maybe a nice library wrapper in std.array, but not much beyond that. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 24, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 --- Comment #6 from github-bugzilla@puremagic.com 2013-09-24 10:06:18 PDT --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/f357fb07cfbb5b64c5a4ccc12a4ce7b83cb7a3b8 Fix issue 10381 Nonsense associative array comparison -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 24, 2013 [Issue 10381] Nonsense associative array comparison | ||||
---|---|---|---|---|
| ||||
Posted in reply to Denis Shelomovskij | http://d.puremagic.com/issues/show_bug.cgi?id=10381 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- 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