[Issue 12491] New: [AA] Disallow non-`immutable` types as associative array keys
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Mar 30 01:18:39 PDT 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12491
Summary: [AA] Disallow non-`immutable` types as associative
array keys
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2014-03-30 12:18:35 MSK ---
Currently associative arrays are implemented with an assumption its keys hash
will not change. The only way to enforce it is to disallow non-`immutable`
(more correct not implicitly convertible to `immutable`) types as associative
array keys. E.g. `int` and `string` keys will still work, `const(char)[]` will
not.
This will cause a massive code breakage when e.g. mutable classes are used as
keys. Note such uses are potentially error-prone and incorrect but looks like
we have already inclined a lot of D users with such pattern.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list