[951] in java-interest
Re: overloading of operators
daemon@ATHENA.MIT.EDU (Gary Funck)
Tue Aug 15 20:52:53 1995
Date: Tue, 15 Aug 95 14:48:22 -0700
From: gary@Intrepid.COM (Gary Funck)
To: java-interest@java.sun.com
Since I sort of brought up the subject of operator overloading, I'd just
like to clarify that I'm neither for 'em or again 'em. I have some
experience using overloaded operators in Ada (yes, I know, a personal
problem), which has a rather complete facility for doing such things.
I found that overloaded operators did help tighten the notation, but
have since been told by others that maintained the code, they would have
preferred function calls. The application was an instruction set
simulator, and I overloaded operations like "+" on target-specific
integers. These operations did more/less what you'd expect, along
with setting condition codes and raising overflow/underflow as a
side-effect. Made a lot of sense (to me) at the time, but maintainers
had trouble keeping track of simulated operations, and real ones
on the language defined types. Another thing I found, was that
as elegant as the operator overloading turned out to be, one still
ended up with some fairly verbose uses of constructors and conversions
to go back and forth between language defined integers and simulated
integers.
The point of my post was simply that the introduction of operating
overloading might lead to some rather "surprising" syntactic
combinations.
| From: "Paul Ambrose" <pambrose@weblogic.com>
| Date: Tue, 15 Aug 1995 11:43:38 +0000
| Subject: Re: overloading of operators
|
| The saying goes: guns don't kill people - people kill people.
|
| Overloaded operators are great when used properly.
| They do not *have* to lead to mind bending semantics
| and inexplicable side-effects.
| It takes a C-trained C++ programmer to abuse and confuse their use.
| I for one would like to be *entrusted* with the ability to
| "do the right thing" WRT overloaded operators in my Java classes.
|
--
| Gary Funck gary@intrepid.com
| Intrepid Technology Inc., Mountain View CA (415) 964-8135
| "Everybody has plans, until they get hit." -- Mike Tyson
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com