4 ms·
BS. I thought that Java already demonstrated to the world how dumb it is to disallow operator overloading altogether. Allowing ANY operator to be overloaded wa
by qalmakka 3y ago
BS. I thought that Java already demonstrated to the world how dumb it is to disallow operator overloading altogether.
Allowing ANY operator to be overloaded was dumb, like C++ did, where you could do batshit crazy stuff like overloading unary & (addressof) or the comma operator (!), or stuff like the assignment operator (that actually opens a parenthesis about how copy/move semantics in C++ are a total hack that completely goes OT compared to this).
Sensible operator overloading makes a lot of sense, especially when combined with traits that clearly define what operations are supported and disallow arbitrary code to define new operators on existing types. Rust does precisely that, and IMHO it works great and provides a much nicer experience than Java's verbose mess of method chaining.