[923] in java-interest

home help back first fref pref prev next nref lref last post

Re: Operator Overloading

daemon@ATHENA.MIT.EDU (Scott Hudson)
Tue Aug 15 16:55:58 1995

From: hudson@cc.gatech.edu (Scott Hudson)
To: java-interest@java.sun.com
Date: Tue, 15 Aug 1995 13:41:01 -0400 (EDT)
Cc: Thomas.Ball@Eng.Sun.COM

Thomas Ball (Thomas.Ball@Eng.Sun.COM) writes:
> Yes, but isn't it interesting that the only examples 
> operator-overloading proponents use are either the one above or numeric 
> types such as matrices? Java already supports the above as a special hack 
> for Strings. 

"Special hacks" were never high on my list of things I wanted in a 
programming language :-) 

> You'll find it much more difficult to come up with a compelling 
> example using any of Java's AWT or Net classes.

I'm not sure I'm a proponent of (conventional) operator overloading, 
but I'll bite.

There are a fair number of things that are just a lot cleaner if you
deal with them in an arithmetic notation.  Points and offsets in a UI
toolkit are a good example.  AWT probably doesn't currently make a lot
of use of it, but geometric operations (e.g., intersect/union of
rectangles and other areas or volumes) are cleaner, as are set oriented
operations on graphs.  Another big class of examples are anything that
involves comparators.  Examples include: manipulation of the vector
timestamps used in partially ordered time in a distributed system, in
general any other sort of partial order, subclass and other kinds of
containment or dominance tests, time/date comparison and manipulation,
various kinds of reachability in graphs, comparison of strings,
subsequence relationships, etc., etc.  Another class of examples
involves operations on container classes.

Scott
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post