[90] in java-interest

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

Re: Overloading of "+" for string concat

daemon@ATHENA.MIT.EDU (patl@asimov.lashley.slip.netcom.co)
Tue May 16 21:11:35 1995

From: patl@asimov.lashley.slip.netcom.com
Date: Tue, 16 May 1995 17:59:19 -0700
To: java-interest@java.Eng.Sun.COM

|>  I ran across an interesting feature/bug last night which makes me
|>  wonder if overloading "+" as string concatenation is such a good idea.
|>  The following code:
|>  
|>    int i = 1; int j = 0; System.out.println("Test: " + i+j);
|>  
|>  produces "10" when many readers might expect "1".  Seems like an argument
|>  for introducing a new operator for string concatenation.  Maybe "::"?

It looks to me more like an argument for -ALWAYS- fully parenthesizing
your expressions...

-Pat

-
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