3 ms·
>That's some spooky action at a distance nonsense. In pretty much all languages operators are just sugar for calling a method. There is no difference other tha
by chlorion 3y ago
>That's some spooky action at a distance nonsense.
In pretty much all languages operators are just sugar for calling a method. There is no difference other than an easier to read syntax.
In rust for example, doing a + b is exactly the same as doing a.add(b).
In python it's exactly the same as doing a.__add__(b).
In C++, my understanding is that its sugar for a.operator+(b) or operator+(a, b).
I think there are some arguments against operator overloading but "spooky action at a distance" doesn't seem to be a very good one to me.