On 02/22/2012 09:32 PM, H. S. Teoh wrote:
The reason is that D guarantees that "==" is: (1) reflexive (a==a for any a); (2) symmetric (a==b if and only if b==a); and (3) transitive (if a==b and b==c then a==c). This allows the compiler to safely optimize expressions containing == comparisons without changing the code's semantics. Allowing one-sided comparisons like you suggest would break symmetry (a.opEquals(b) != b.opEquals(a)), and likely transitivity as well. T
Fair enough.  I love how everything in D has reasons.

Thanks for all the help. Although you guys should be careful because if you keep giving such in depth answers I might start asking stupid questions just to learn the language in more depth :)

Reply via email to