http://d.puremagic.com/issues/show_bug.cgi?id=8681
hst...@quickfur.ath.cx changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hst...@quickfur.ath.cx --- Comment #1 from hst...@quickfur.ath.cx 2013-07-08 20:10:39 PDT --- There's a case where accepting mutable keys may be OK: class C { immutable int x; int y, z; this() { ... /* initialize x */ } size_t toHash() const { // The "real" data is in x; y and z are used for, e.g., caching // or holding temporary values return typeid(int).getHash(x); } bool opEquals(const C c) const { return x == c.x; } } Since both toHash and opEquals only depend on C.x, it should be permissible to accept mutable C as AA key; the immutability of C.x guarantees we won't run into problems. The problem is, I don't think such a case is expressible in the current type system. (Though arguably, such cases are probably bad design and shouldn't be encouraged/catered to.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------