develooper Front page | perl.perl6.language | Postings from November 2002

Re: String concatentation operator

Thread Previous | Thread Next
Larry Wall
November 23, 2002 13:05
Re: String concatentation operator
Message ID:
On Sat, Nov 23, 2002 at 07:34:47PM +0000, Simon Cozens wrote:
: (Smylers) writes:
: > >    ... they believed that the + should concatenate the two strings.
: > > 
: > > Makes perfect sense to me.
: > 
: > Makes sense in a language where variables are typed
: It also makes sense in a language where values are typed. They just
: have to be slightly more strongly typed than just "scalar". But Perl 6
: is already going to support INT and STRING built-in types, right? So I
: see no problem with + doing string concat. I could mention some other
: languages (or at least, a language (of which I'm becoming considerably
: more fond as I get to know it (especially having just come back from
: Japan (excuse the jet lag)))) which takes this approach.

While no assumption is going unquestioned for Perl 6, I do still
believe that the decision not to overload + for concatenation is one
of the few things I did right in Perl 1.  When people look at $a + $b
in Perl they don't have to wonder what it means.  Addition is such a
fundamental operation that it should be kept as clean as possible, both
for readability and for optimizability.  (The two are not unrelated.)

There are several things I like about Ruby, but using + for string
concatenation is not one of them.  It's another one of those areas
where the Principle of Least Astonishment is misapplied.  Any language
that doesn't occasionally surprise the novice will pay for it by
continually surprising the expert.  Ruby's scoping rules also fail
on this point, in my estimation.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About