3 ms·
>operator overloading, mostly for math like matrices, vectors, complex numbers They took out operator overloading deliberately when they designed Java because
by gozur88 9y ago
>operator overloading, mostly for math like matrices, vectors, complex numbers
They took out operator overloading deliberately when they designed Java because in practice people mostly use it to obscure what's happening instead of making things more clear.
- wvenable 9y agoIn C++ operator overloading was used by the standard library to obscure everything. I can see why Java took the direction that it did. But, on the other hand, we've learned from those mistakes and pretty much any new language that has operating overloading it's used both appropriately and sparingly (C#, Python, etc). It's one of those things that as a developer you'd never use yourself but when you need them they're extremely handy. I'd loved doing matrix math in C++ -- I could translate complex mathematical expressions directly into code with almost no translation.
- gozur88 9y agoI agree it's a valuable feature if used in the right places. The problem is when you get a C++ job with an existing code base, particularly one which has been maintained by a lot of people over many years, invariably you're going to find operator overloading everywhere.