WAT: opCmp and opEquals woes

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 21:27:01 PDT 2014


On 7/25/2014 8:47 PM, Manu via Digitalmars-d wrote:
> Would you argue that == and != are unrelated, distinct and separate operations
> from <,<=,>=,>, and they should never be used in conjunction, or assumed to be
> related?
> I think any reasonable person will assume that the suite of comparisons are
> related operations.

Any reasonable person would assume that floating point (a+b)+c == a+(b+c) but it 
does not work that way.

Andrei gave a specific example in this thread.

There is a reason that both opEquals and opCmp defined in the language, and that 
opEquals is for == and !=, and opCmp is for < <= > >=.

Conflating them together is a mistake.


More information about the Digitalmars-d mailing list