And I also LOVE C++ operators even if don't use them too much, because I
LOVE to write:
obja = objb;
I don't see how the above could be confusing to anyone.
It *looks* very simple and easy to understand, true, but what does it
actually *mean*?
If this was Java I would know *precisely* and *unambiguously* what it
means; it copies whatever value the pointer variable objb has to the
variable obja. In C++ it could mean *absolutely anything*.
For all I know, obja could represent a database, objb could be a
random object that has a toString method, and the designer of the
database class thought it would be really "clever" that if you
assigned a string to the database then clearly what you want to do is
execute some SQL. And maybe it's just a typo in my code, I really
meant to assign to obja1 which has the same type as objb, not talk to
the database at all, but the compiler helpfully applied a cast for me.
Granted, it probably won't, or if it does the names of the classes or
the API documentation (if there is any) might make it clear what
they're intended for, but it could. Short of guessing, or knowing
because I wrote the code, or trailing through hundreds of header
files, I have absolutely no way of knowing for certain what this
apparently simple statement does.
Operator overloading is absolutely, completely and utterly evil, sorry.
-Rolf
--
Rolf Howarth, Square Box Systems Ltd, Stratford-upon-Avon UK.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden