3 ms·
Hogwash. In a language with operator overloading, this would be something like `a.assign(b.plus(c))`. Which really doesn't tell you more about what go on under
by norswap 10y ago
Hogwash. In a language with operator overloading, this would be something like `a.assign(b.plus(c))`. Which really doesn't tell you more about what go on under the wraps than the operator form.
What can be confusing is what the meaning of `+` (or `plus` is). In some case it can be fairly obvious (e.g. concatenating sequences), while in other not so much. Operator overloading is nice, but has to be used tastefully (like every abstraction or language tool).
- grey-area 10y agoIn C#, you can overload operators, so the + could in theory do anything. What can be confusing is what the meaning of `+` (or `plus` is) QED
- norswap 10y agoAny function can do anything. I can write a function called "read_from_file()" that doesn't read any files. Amazing, I know. Also please actually read the comment before replying: > Operator overloading is nice, but has to be used tastefully.
- grey-area 10y agoThe point the OP made was that operator overloading is not nice - it means that any operator (not just function) can do anything. It makes code harder to read and reason about.