digitalmars.D.bugs - [Issue 12492] New: [AA] Clarify what types can be used to get associative array key value
- d-bugmail puremagic.com (34/34) Mar 30 2014 https://d.puremagic.com/issues...
https://d.puremagic.com/issues/show_bug.cgi?id=12492 Summary: [AA] Clarify what types can be used to get associative array key value Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: verylonglogin.reg gmail.com --- Comment #0 from Denis Shelomovskij <verylonglogin.reg gmail.com> 2014-03-30 13:02:34 MSK --- Currently there is no clear rules about types which can be used to get associative array key value, e.g. one may expect to be able to get `int[string]` AA value using `char` and vice-versa. In case of setting value it's simple, a key expression type should be implicitly convertible to associative array key type (i.e. we need just fix Issue 2954). The case of getting AA value is more complicated because all we need is: 1. Ability to compare values of these types. 2. Equality of hash sums of equal values of these types. So at least this mean `const`/`immutable` type qualifiers can be ignored iff we always use same hash algorithms regardless of type qualifiers. It's a bug, not an enhancement because current compiler behaviour is inconsistent, e.g. it allows getting `int[Object]` AA value using `immutable Object` but disallows getting `int[Object]` AA value using `immutable Object` and even `const Object`. Also see Issue 12491 about the idea to disallow any non-`immutable` types as associative array keys. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 30 2014