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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Sep 15 13:02:25 PDT 2014


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #31 from Steven Schveighoffer <schveiguy at yahoo.com> ---
You realize this now SILENTLY breaks such code? Anyone who defined opCmp and
toHash to be other than the default, left opEquals alone, will have their AA
keys compile silently, and then do the completely wrong thing?

This was not a regression. It is an unfortunate step REQUIRED because of the
state of D before this change. Before the change, regardless of what the spec
said, only opCmp was used. opEquals was not used. If one defined opCmp, but not
opEquals, no error was raised, and it worked as expected. Now that we switched
to using opEquals instead of opCmp, even though the spec has warned such users
not to depend on implementation details such as this, it will break code.

In reverting this change, we have introduced a silent breaking regression.

I'll also note that the equivalent class requirements are still in there. In
other words, change TagIndex to a class, and you still get the error.

There was a lot of work and thought put into this before the release, I'm
surprised it was killed so quickly. I respectfully ask that it be reinstated.
If we all decide that such users should just be screwed for not reading the
fine print of the spec, then I guess that's what's been decided. At least,
remove the class error as well.

--


More information about the Digitalmars-d-bugs mailing list