3 ms·
The first programming language that used overloaded operators I really got into was Scala, and I still love it. I love that instead of Java's x.add(y); I can ov
by ecshafer 1y ago
The first programming language that used overloaded operators I really got into was Scala, and I still love it. I love that instead of Java's x.add(y); I can overload + so that it calls .add when between two objects of type a. It of course has to be used responsibly, but it makes a lot of code really more readable.
- Attrecomet 1y agoExactly, not allowing operator overload leads to Java hell, where we need verbose functions for calls that should be '+' or similar.
- lelanthran 1y ago> The first programming language that used overloaded operators I really got into was Scala, and I still love it. I love that instead of Java's x.add(y); I can overload + so that it calls .add when between two objects of type a. It of course has to be used responsibly, but it makes a lot of code really more readable. The problem, for me, with overloaded operators in something like C++ is that it frequently feels like an afterthought. Doing "overloaded operators" in Lisp (CLOS + MOP) has much better "vibes" to me than doing overloaded operators in C++ or Scala.