[Issue 2482] Spec does not reference about special x functions in TypeInfo_Struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 21 18:57:18 UTC 2019


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

--- Comment #4 from Steven Schveighoffer <schveiguy at yahoo.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list