On Friday, 25 July 2014 at 18:54:15 UTC, Daniel Gibson wrote:
Am 25.07.2014 18:11, schrieb "Marc Schütz" <[email protected]>":
I'm astonished that it doesn't work like that already. When I
first read
the operator overloading docs, I really liked that in D I
don't need to
define all the individual comparison operators, but only
opCmp. I
Well, to be fair the documentation, is pretty explicit about
it, the headings are "Overloading == and !=" and "Overloading
<, <=, <, and <=".
Whatever the outcome of the discussion will be, it needs to be
documented much better. The current documentation doesn't say
anything about whether or not, and how opEquals and opCmp relate.
I doesn't even mention that they are supposed to be consistent.
I'm just afraid that it will not be noticed, because it will be
"hidden" in the documentation. If the status quo is kept, you
just won't know you've written wrong code, even though the
compiler has all the means to tell you.
The D1 documentation even had a rationale why there's both
opEquals and opCmp, no idea why that was dropped for D2.
However, I read about opCmp at some time and in the meantime
forgot about the "not for ==" part - but this is probably a
problem with my brain (or the long timespan) and not with the
documentation.
Well, you're not the only one :-(