Ben said:
Yes, that is the fair comparison and it does highlight a difference.
To fully understand the latter I must go find those functions (or
possibly just the documentation for them). To understand the former,
I must first find the declarations of the variables and /then/ find the
definitions (or documentation) for + and = for that type. Operator
(and function) overloading adds a level of indirection to the process
of comprehension.
While operator overloading and the overloading of functions in general
are, in principle, separable concepts, it seems to me that they are a
natural combination. When both are present (as is the case in the only
languages I'm familiar which which provide operator overloading), the
distinction you are making disappears. You have to know what types of
the arguments are, before you can determine which overload is being
invoked. The difference between operator+() and add() is merely a matter
of notational convenience; what you've presented is an argument against
function overloading in general, not operator overloading in particular.
And, insofar as you can trust the person who wrote the code to have done
a decent job, you really don't need to know which overload is being
executed in order to understand the code. If that person overloaded
operator+() reasonably, then it does something that is analogous to
addition; if it isn't clear from context what that something is, then
it's not a reasonable candidate for operator overloading. Similarly, if
the name of the add() function was chosen reasonably, then it does
something ... [repeat rest of previous sentence, with appropriate
adjustments].
When you're debugging, then inherently the trust is gone. However, in
precisely that context, if you're using a language that supports
overloading, you should be using an IDE that will keep track for you of
which overload it is that is relevant. Without such an IDE, you're
better off not even using overloading.
It seems to me undeniable that the execution model of overloaded code
is (slightly) more complex, but it is not obvious that that results in
code that is, inevitably, harder to maintain. Programs that use
overloading well can be clear and easy to maintain because of the
expressiveness of the mechanism. (I confess this is no more than a
guess.)
On a non-technical level, some language features seem more prone to
beginner abuse than others, and overloading (specifically operator
overloading) seems to be one of them.
I'd never let a beginner work on my code without close supervision,
unless I had no other choice (which has, unfortunately been the case
more often than I'd like).