[2046] in java-interest

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

re: extending String functionality

daemon@ATHENA.MIT.EDU (Smiljan Grmek - KSI ZGB)
Fri Sep 22 11:35:05 1995

Date: Fri, 22 Sep 1995 13:50:59 +0200 (MET DST)
From: Smiljan Grmek - KSI ZGB <sgrmek@public.srce.hr>
To: Andrew Gilmartin <ajg@cadre.com>
cc: java-interest@java.sun.com
In-Reply-To: <9509191911.AA01488@cadre.com>


On Tue, 19 Sep 1995, Andrew Gilmartin wrote:

> >  a.set_value( a.get_value() + 1 );
> >What I wished to be allowed to write :
> >  a = a + 1; 
> >or
> >  a += 1;
> 
> I would write
> 
>         a.increment()
> .... 

This brings us back to the operator overloading in Java, already almost 
hacked to death. I would still like to give some reasonable food for 
thought in this regard.

It is really psychologically true that people find it much easier to read 
binary infix operators than functional (method invocation) notation. 
Although it is a bit late in the game, the Java team might consider a
syntactical embellishment: 

       "(" ref1  method ref2 ")"  to be equivalent to
       method(ref1,ref2)          if an adequate method exists.

This will make infix operatore truly more readable, the parentheses would 
obviate any need for operator priority specification, and the operators 
would still have identifier names. So you would write:

	(Amatrix matmult (Bmatrix matadd Cmatrix))

Ternary and higher order operators are written in prefix functional 
notation anyway in almost all languages (with notable exception of 
Smalltalk).

Regards Smi

Smiljan Grmek
KSI Zagreb
-
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