WAT: opCmp and opEquals woes

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 14:04:43 PDT 2014


On Fri, Jul 25, 2014 at 07:10:50PM +0000, via Digitalmars-d wrote:
> On Friday, 25 July 2014 at 18:54:15 UTC, Daniel Gibson wrote:
[...]
> >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 :-(

Yeah, we definitely need to improve the docs so that the distinction is
clearer.


T

-- 
Дерево держится корнями, а человек - друзьями.


More information about the Digitalmars-d mailing list