J
John W Kennedy
Patricia said:Who is "we"? I know it does not include me.
C++ suffered from a special problem, being the first very widely used
language to support them. There was a lot of experimentation, with some
of the experiments leading to understanding of what things operator
overloading is *not* good for.
I strongly disagree with the first couple of sentences. The single thing
that operator overloading would do well is allowing more natural-looking
code for non-primitive arithmetic. Using anything other than "+" for
addition is just as unreadable as using "+" for something other than
addition.
It is too late to keep the language designers from bad operator
overloading. String concatenation is not addition, and should not be
represented by "+".
But, quite seriously, why? Group theorists have been utterly at home
with the notion for ages. And what of Boole? Maybe I was exposed to such
ideas at an unusually early age, but, to me, this complaint seems simply
silly. (Please understand that I do /not/ see you as a silly person,
because you aren't, and, besides, "Patricia" was my mother's name.)
There are, God knows, theoretical cases where operator overloading can
be ridiculous. But the idea that string+string cannot mean
concatenation, or that stream>>data and stream<<data cannot signify I/O,
just makes no sense to me. (I have issues with C++, but this is not one
of them.)
I am, of course, assuming a base language in which wild implicit
casting, as in PL/I or most scripting languges, is not present, so that
string+string cannot sensibly mean addition, because strings cannot be
arithmetically added. In a language where they can, things change.
I also grant that it is /much/ more important to get operators into
complex and extended-precision arithmetic than otherwise.