> Robert@babelfish ~
> $
> 
> There is no way the parser can disambiguate concatenation of strings
> referenced through variables and method invocations whereas a
> concatenation of string literals is easily detectable.
> 
> Apart from that, I believe it is quite common in programming languages
> to allow concatenation of string literals although that feature might be
> rarely used.
> 
> Kind regards
> 
>   robert


I think you misunderstand what I was saying.  I was not asking what the 
differences between the parser and the runtime are.  I was asking for a 
rationale.  If Matz believed that strings, when placed together without 
any punctuation between them should be concatenated, why didn't he make 
it standard operating behavior?  I can't imagine it would have been so 
difficult for when the parser sees two variables in a row to treat it as 
equivalent to a concatenation call on the first variable with the second 
variable as an argument.  If Matz didn't think that two strings should 
be concatenated, why program that behavior into the parser?

It seems to me like the rationale behind not having a standard method 
call (like concatenation) for two variables appearing next to each other 
is that you feel there is some value in having the parser register that 
syntax as an error (as opposed to having the runtime display a no method 
error).  But if you feel that two things next to each other should 
trigger alarm bells, why not also with two strings.

["one" "two", "three"]

seems like it should really throw an error to me.  If I really wanted 
["onetwo", "three"] I would have written "onetwo" as a single string.

I have a really hard time coming up with cases where writing two strings 
next to each other in code is preferable to writing a single longer 
string.  The single string uses fewer characters, even.  I have a 
remarkably easy time coming up with cases where someone forgets to type 
a comma.
-- 
Posted via http://www.ruby-forum.com/.