<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 26 July 2014 19:48, Andrei Alexandrescu 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On 7/26/14, 2:19 AM, "Marc Schütz" <<a href="mailto:schuetzm@gmx.net" target="_blank">schuetzm@gmx.net</a>>" wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Saturday, 26 July 2014 at 07:42:05 UTC, Ola Fosheim Grøstad wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Saturday, 26 July 2014 at 06:50:11 UTC, Manu via Digitalmars-d wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
It's okay, I hate it too.<br>
But I equally can't abide == meaning something different than <, <=,<br>
etc.<br>
That's insane.<br>
</blockquote>
<br>
Yes, it is unsound to use opCmp for types that aren't totally ordered:<br>
</blockquote>
<br>
Yes, that's why it's possible to provide opEquals in addition to opCmp.<br>
But for the vast majority of cases, opEquals _is_ equivalent to opCmp ==<br>
0, and element-wise equality is not. Defining opEquals to be the latter<br>
by default _even in the presence of opCmp_ is therefore wrong in almost<br>
all cases.<br>
</blockquote>
<br></div></div>
Case-insensitive ordering is a simple example. Field for field comparison is the right default whether or not opCmp is defined.<br></blockquote><div><br></div><div>...you're trolling me right?<br></div><div><br></div>
<div>Just to be clear, you're saying you think it's reasonable for <, <=, >=, > to perform case insensitive comparison for ordering purposes, but for ==, != to be case sensitive for equality comparisons?</div>
<div>You're saying you think that's what the user *probably* wants, by default? Is there precedent for something like this? I've never seen anything like it.</div><div>It creates very awkward relationships between the suite of operators which is likely to break down in many logical constructs.<br>
</div><div><br></div><div>I don't understand; your example is the perfect example of why opCmp==0 should be the default opEquals, but somehow it's an argument against? I have no idea how to reason about this topic.</div>
<div>I come from a place where <,<=,==,!=,>=,> are a suite, and it is reasonable to assume they all work the same. Is that not the default presumption of modern programmers? Is it really so unlikely that people would make the mistake of assuming they are related?</div>
</div></div></div>