@dkf said in WTF Bites:
The problem with operator overloading is that it is difficult to actually get right, so when it is done it is usually done wrongly, and you instead end up with substantive amounts of code use hidden almost in plain sight
It's one of those things that is a huge boon to readability when used properly, but requires care.
if(app.CurrentVersion > new Version("6.2.1")) { ... } is great, and much more semantically clear than having to write the method call if(app.CurrentVersion.isLaterThan(new Version("6.2.1"))) { ... }. Or a vector maths library that lets me do
Vector3 X = new Vector3(1, 0, 0), Y = new Vector3(0, 1, 0);
var v = X + Y;
... though you always have the fight over whether X*Y should be dot or cross product.
But I'm deeply unconvinced about C++ stream semantics, which make << and >> fundamentally do different things from their original definition. And although I like equality overrides (I write Java professionally and littering code with .equals makes it less readable), you do have to be careful to do it right.
Implicit casts, Linq and lambdas are all examples of things that need to be done well or not at all.