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

--- Comment #4 from Steven Schveighoffer <[email protected]> ---
So since this was opened (11 years ago!), the .sort property is gone. And AAs
have been adjusted to require only opEquals and toHash.

Not only that but the compiler has been adjusted to complain if you define one
but not the other.

See: https://dlang.org/spec/hash-map.html#using_struct_as_key

Which means if you don't use the right signature, it will complain anyway.

The only remaining thing that is an undisclosed issue is the TypeInfo methods
that use these items (i.e. .getHash .compare .equals). These are affected if
you define the right signature, and there will be no complaints if you don't
use them in an AA.

Perhaps here: https://dlang.org/phobos/object.html#.TypeInfo

You could put notes about custom functions for the three methods on structs
(classes are already required to override) and identify the "correct" signature
that is guaranteed to be used. And you may want to research what DMD does,
because I actually don't know the requirements.

--

Reply via email to