On 19.02.2010 17:40, Raul Jara wrote:
> Robert Klemme wrote:
>> 2010/2/19 Raul Jara<raul.c.jara / gmail.com>:
>>> �rom /opt/local/bin/irb:12:in `<main>'
>>>
>>>
>>> Which is a little counter intuitive.
>>
>> Not for me.  The concatenation is done at parse time.  Your
>> "whitespace concatenation" is done at runtime.
>
> I guess I find it counter intuitive to have such different behaviors
> parse time vs. run time.

Why?  Parsing and executing are two fundamentally different things.

>  If it isn't suppose to be a behavior of
> strings that you can stick one next to another and have them
> concatenate, then my brain has a hard time understanding why the parserhould treat them as though they do have that behavior?

At least because of ambiguity: this line is a valid method invocation:

Robert@babelfish ~
$ ruby19 -ce 'foo bar'
Syntax OK

Robert@babelfish ~
$ ruby19 -e 'foo bar'
-e:1:in `<main>': undefined local variable or method `bar' for 
main:Object (NameError)

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 arely used.

Kind regards

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/