[958] in java-interest

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

Re: operator overloading

daemon@ATHENA.MIT.EDU (Terence John Parr)
Tue Aug 15 22:21:54 1995

Date: Tue, 15 Aug 1995 16:09:14 -0700
From: Terence John Parr <parrt@parr-research.com>
To: Glen.Perkins@NativeGuide.com, java-interest@java.sun.com

> Why not allow the creation of binary "operator" methods with the operator
> syntax, but not allow the operators themselves to be reused? Perhaps any
> 2-argument method could be used with either normal or operator syntax. The
> above example could then be written as:
> 
> c = (a complexAdd b) complexDiv b;

Looks nice, but that's SmallTalk and a definite departure from Java.
I like SmallTalk BTW.

This feature would really make things complicated for both the implementors
and programmers I'd guess.

> This would tell you immediately that the "operators" were user-defined when
> you tried to read a line like this in someone else's code so you would be
> less likely to make unconscious assumptions about them.

True, but let's go with your natural reaction to stay away from overloading.
Also, the ability to define your own operators may prove worse than just
allowing the ability to overload them.

Terence
-
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