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

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2482

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P3

--


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

2019-12-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2482

--- Comment #5 from Steven Schveighoffer  ---
Actually, may be good to elaborate on the points in the AA docs.

I found that defining a toHash function without const makes it skip the
function for xtoHash.

A note saying "Only the above signatures are guaranteed to work with AAs. If
you change the signature in some way, it may not work"

Defining opEquals without const makes it fail to be an AA key.

--


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

2019-12-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2482

--- Comment #4 from Steven Schveighoffer  ---
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.

--


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

2019-12-21 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2482

berni44  changed:

   What|Removed |Added

 CC||bugzi...@d-ecke.de

--- Comment #3 from berni44  ---
I'm not sure at what place in the docs you'd like to see these functions
mentioned. So I was not able to decide, if this issue is still valid.

--


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

2016-12-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=2482

Andrei Alexandrescu  changed:

   What|Removed |Added

   Keywords||trivial
 CC||and...@erdani.com

--


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

2014-03-19 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2482


Steven Schveighoffer schvei...@yahoo.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   Platform|x86 |All
Version|2.019   |D2
 Resolution|FIXED   |
 OS/Version|Windows |All


--- Comment #2 from Steven Schveighoffer schvei...@yahoo.com 2014-03-19 
10:35:48 PDT ---
This isn't exactly what I meant. It hints at the correct signature, but does
not detail the reason for using that signature (i.e. it won't be used when
calling TypeInfo.compare or TypeInfo.equals).

In addition, the opEquals documentation is not very clear at all. Only ONE form
gets turned into the xopEquals function pointer.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


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

2014-03-18 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=2482


Infiltrator lt.infiltra...@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||lt.infiltra...@gmail.com
 Resolution||FIXED


--- Comment #1 from Infiltrator lt.infiltra...@gmail.com 2014-03-18 21:55:17 
PDT ---
The docs correctly provide the signature as 'int opCmp(ref const S s) const {
... }'

http://dlang.org/operatoroverloading.html#compare

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---