[Issue 13179] AA key type TagIndex now requires equality rather than comparison

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jul 25 14:52:51 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13179

--- Comment #22 from hsteoh at quickfur.ath.cx ---
Alright. I think the forum discussion has convinced me that having opEquals =
(opCmp()==0) is a bad idea.

Instead, Jonathan's solution is the best: get rid of the compile error that
forces you to declare opEquals just because you declared opCmp. Code that
defines opCmp that's inconsistent with opEquals is already broken, and we
aren't making things worse. Assuming that the user-defined opCmp is consistent
with opEquals, then the AA code change that switched from using
typeinfo.compare to typeinfo.equals should still work correctly on existing
code. So this sounds like the best way to go.

--


More information about the Digitalmars-d-bugs mailing list