Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Martin Gregorie Newsgroups: comp.lang.java.programmer Subject: Re: Java blunders Date: Sat, 26 Jul 2014 20:11:24 +0000 (UTC) Organization: A noiseless patient Spider Lines: 28 Message-ID: References: <53cef75d$0$291$14726298@news.sunsite.dk> <7s6vs9p395bretqrtdvh9i6til83vfk52p@4ax.com> <53d04b5f$0$291$14726298@news.sunsite.dk> <53d19752$0$295$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Sat, 26 Jul 2014 20:11:24 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="e5160e2be48f1ea550cf61512446f525"; logging-data="28344"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hyE0tKpPYX3nDCv6iBdUGizc0hgkO0Qk=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:0OxMVetjt76Mm4709I1Oy3kNRtw= Xref: csiph.com comp.lang.java.programmer:29350 On Sat, 26 Jul 2014 09:06:28 -0700, Roedy Green wrote: > If we did get a distinct concatenation operator, what would it be? > Perl and PHP use . as the string concatenation operator. It seems as good as any to me: $ perl -e 'print "My cat " . "sat on" . " the mat.\n";' My cat sat on the mat. $ I'll take issue with your comment about applying + to strings as being arithmetical in intent. If that was really the case, then the expression "123" + "9" would return "132" rather than "1239". Just look at what Perl does with + operator (the same with string operands as it does with integers): $ perl -e 'print "123" + "3" . "\n";'; perl -e 'print 123 + 3 . "\n";' 126 126 $ -- martin@ | Martin Gregorie gregorie. | Essex, UK org |