WAT: opCmp and opEquals woes
Regan Heath via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 25 04:10:31 PDT 2014
On Fri, 25 Jul 2014 09:39:11 +0100, Walter Bright
<newshound2 at digitalmars.com> wrote:
> On 7/25/2014 1:02 AM, Jacob Carlborg wrote:
>> 3. If opCmp is defined but no opEquals, lhs == rhs will be lowered to
>> lhs.opCmp(rhs) == 0
>
> This is the sticking point. opCmp and opEquals are separate on purpose,
> see Andrei's posts.
Sure, Andrei makes a valid point .. for a minority of cases. The majority
case will be that opEquals and opCmp==0 will agree. In those minority
cases where they are intended to disagree the user will have intentionally
defined both, to be different. I cannot think of any case where a user
will intend for these to be different, then not define both to ensure it.
R
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Digitalmars-d
mailing list