[Issue 13179] AA key type TagIndex now requires equality rather than comparison
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed Jul 23 13:04:22 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13179
--- Comment #14 from hsteoh at quickfur.ath.cx ---
I think the toHash issue is really only applicable if you try to use your type
as an AA key. If you never use it as an AA key, there's no reason to require
the user to define toHash just because they defined their own opEquals. AFAIK
the latest dmd git HEAD will reject using types as AA keys if they define one
of toHash/opEquals but not both. So either you don't define either and get the
default implementations, or you define both and the onus is on you to make them
consistent with each other. The compiler rejects the code if you define one but
not the other, which makes sense.
But there's no reason to require toHash to be defined if the user never tries
to use it as an AA key, even if they define opEquals.
--
More information about the Digitalmars-d-bugs
mailing list