[Issue 10374] New: Associative arrays work with unoverriden `toHash`/`opEquals`/`opCmp`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 16 03:01:34 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10374
Summary: Associative arrays work with unoverriden
`toHash`/`opEquals`/`opCmp`
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-06-16 14:01:33 MSD ---
Documentation states classes must override `toHash`/`opEquals`/`opCmp` to work
as associative array keys. But current implementation works anyway.
As people are lazy I suppose lots of such classes are already used as
associative array keys.
So once e.g. compacting GC will be implemented and `Object`'s `toHash` equality
will stop being class instance address equality current AA implementation will
start using `Object`'s `opCmp` which will throw thus breaking lots of code.
I'd suggest to either document such usage or check in AA implementation that
required functions are overriden.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list