[150] in java-interest

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

Re: String concatenation operator

daemon@ATHENA.MIT.EDU (James Cownie)
Tue May 30 12:12:27 1995

Date: Tue, 30 May 1995 09:30:43 +0000
From: jim@meiko.co.uk (James Cownie)
To: java-interest@java.Eng.Sun.COM

There's been a bunch of discussion here on the subject of the string
concatenation operator, and, in particular whether the choice of the
character '+' is a good one. (And more to the point, whether the high
operator precedence which results from choosing '+' is good).

However no one has yet pointed out that ANSI C already has a (rather
limited) string concatenation operator. I can't give you the character
to which this operator is bound, since there isn't one ! It exists in
the rule that "... any sequence of adjacent character string literal
tokens are concatenated into a single multibyte character sequence."

In other words placing two character string literals next to each
other concatenates them.

I haven't checked whether Java already implements this rule, or
not. In as much as it follows C it should do. If so, (and following
the rule that Java is just like ANSI C with suitable sympathetic
extensions), it seems reasonable to propose an extension of this empty
operator to non-literal strings. Since the operator is so
visually insignificant it also makes a lot of sense to give it a very
low operator precedence (as seems desirable).

(Of course parsing this may prove amusing !)

-- Jim 

James Cownie 
Meiko Limited			Meiko Inc.
650 Aztec West			130C Baker Avenue Ext.
Bristol BS12 4SD		Concord
England				MA 01742

Phone : +44 1454 616171		+1 508 371 0088
FAX   : +44 1454 618188		+1 508 371 7516
E-Mail: jim@meiko.co.uk   or    jim@meiko.com
WWW   : http://www.meiko.com/welcome.html

-
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