<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 25 July 2014 14:50, Walter Bright via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 7/23/2014 9:45 AM, H. S. Teoh via Digitalmars-d wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<a href="https://issues.dlang.org/show_bug.cgi?id=13179" target="_blank">https://issues.dlang.org/show_<u></u>bug.cgi?id=13179</a><br>
</blockquote>
<br>
Consider also:<br>
<br>
<a href="http://www.reddit.com/r/programming/comments/2bl51j/programming_in_d_a_great_online_book_for_learning/cj75gm9" target="_blank">http://www.reddit.com/r/<u></u>programming/comments/2bl51j/<u></u>programming_in_d_a_great_<u></u>online_book_for_learning/<u></u>cj75gm9</a><br>

<br>
The current scheme breaks existing code - code that was formerly correct and working.<br>
<br>
AAs don't make sense if the notion of == on members is invalid. AAs formerly required opCmp, and yes, opCmp could be constructed to give different results for opCmp==0 than ==, but I would expect such an object to not be used in an AA, again because it doesn't make sense.<br>

<br>
Using the default generated opEquals for AAs may break code, such as the an AA of the structs in the parent post, but it seems unlikely that that code was correct anyway in an AA (as it would give erratic results).<br>
<br>
Kenji's rebuttal <a href="https://issues.dlang.org/show_bug.cgi?id=13179#c2" target="_blank">https://issues.dlang.org/show_<u></u>bug.cgi?id=13179#c2</a> is probably the best counter-argument, and I'd go with it if it didn't result in code breakage.<br>

</blockquote></div><br></div><div class="gmail_extra">I don't really see how opCmp == 0 could be unreliable or unintended. It was deliberately written by the author, so definitely not unintended, and I can't imagine anybody would ever deliberately ignore the == 0 case when implementing an opCmp, or produce logic that works for less or greater, but fails for equal.<br>
</div><div class="gmail_extra"><= and >= are expressed by opCmp, which imply that testing for equality definitely works as the user intended.</div><div class="gmail_extra"><br></div><div class="gmail_extra">In lieu of an opEquals, how can a deliberately implemented opCmp, which we know works in the == case (otherwise <= or >= wouldn't work either) ever be a worse choice than an implicitly generated opEquals?</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">Personally, just skimming through this thread, I find it baffling that this is controversial.</div></div>