March 30, 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@puremagic.com
        ReportedBy: verylonglogin.reg@gmail.com


--- Comment #0 from Denis Shelomovskij <verylonglogin.reg@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: -------