== Quote from bearophile (bearophileh...@lycos.com)'s article > This is not terrible, because for those two operations I define only the > method with English name, but this is a small limit of opCmp. In expression templates you are able to use the same solution. > Is this usage for the set API operator overloading abuse? I am not sure. I > think it's acceptablre.
Reasonable people can disagree on this, but I say definitely yes. I don't regret that operator overloading exists in D since I don't believe in throwing the baby out with the bath water when it comes to language design. That said, I believe that unless an operator overload does something conceptually identical to what it does for builtin types, it's an abuse of operator overloading. For example, using '+' for string concatenation, '<<' to write to streams, '+' to append to a stack, or comparison operators for dealing with sets is a severe abuse. I'm even hesitant to use '*' for matrix multiplication since I fail to see how matrix multiplication is conceptually related to scalar multiplication. I wish these were treated as unrelated operations in standard mathematical notation, for example using '.' for matrix multiplication. However, if I ever get around to finishing my SciD enhancements, I will grudgingly defer to de facto standards and use it.