WAT: opCmp and opEquals woes

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 06:51:41 PDT 2014


On Fri, Jul 25, 2014 at 02:08:55PM +0200, Jacob Carlborg via Digitalmars-d wrote:
> On 25/07/14 12:09, Jonathan M Davis wrote:
> 
> >The _only_ code that would break would be code that's _already_
> >broken - code that defines opCmp in a way that's inconsistent with
> >the default opEquals and then doesn't define opEquals. I see no
> >reason to worry about making sure that we don't break code that's
> >already broken.
> 
> I see no reason why I should define opEquals when opCmp was used for
> AA keys. You keep ignoring that argument.
[...]

AA's don't care about keys being orderable, all they care about is that
keys should have a hash value, and be comparable. It was a mistake to
use opCmp for AA keys in the first place. We're now fixing this mistake.

The issue at hand is really more of easing the transition from the old
buggy design so that we don't break old code where they used to work
correctly.


T

-- 
Error: Keyboard not attached. Press F1 to continue. -- Yoon Ha Lee, CONLANG


More information about the Digitalmars-d mailing list