5 ms·
The author definitely understands that. The point is: when you don't have operator overloading you get stuff like that which does demonstrably confuse many peop
by delta64 4y ago
The author definitely understands that. The point is: when you don't have operator overloading you get stuff like that which does demonstrably confuse many people
In languages with operator overloading this just isn't a concern at all because == does the obvious thing
- AnimalMuppet 4y ago== should do the obvious thing. But with operator overloading, it's not clear that it does, unless you need to read the implementation of == very carefully.
- delta64 4y agoHow is that any different to some opaque method call? By the same logic `a.equals(b)` might be doing something funky under the hood
- AnimalMuppet 4y agoTrue. But people think about it a bit differently. People don't always expect == to be a function call.
- delta64 4y agoSure, but I think '== might be a function call' is a lot less confusing than '== sometimes compares for equal value and sometimes doesn't'
- SeanLuke 4y ago> In languages with operator overloading this just isn't a concern at all because == does the obvious thing And what is the obvious thing? It varies wildly among languages, even within C++ itself.
- delta64 4y agoThe obvious thing is to check if the contents are equal. I don't know what cursed C++ you're looking at if you're finding a ton of string implementations not doing exactly that...