David Krmpotic wrote:
> Robert James wrote:
>> Is there an idiomatic way to continue a long quote on a separate line,
>> or should I just do:
>> 
>> "If you need help," +
>> " please dial the operator"
> 
> Hmm, I don't think you can..
> 
> if you do (which you can)
> 
> "If you need help
> please dial the operator"
> 
> you'll get '\n' sneaked in there...
> 
> I think that using '+' is the only way. Now the question is if that 
> affects performance at all.. I wouldn't know.

At a guess, I would say that using + means it has to go through 
String#+. If you write something like

  class String
    alias old_plus :+
    def + other
      puts "adding strings "#{other}"
      old_plus other
    end
  end

On the other hand, if you use a lexical construct like

  "asdf asdf" \
  "asdf asdf"

Then the compiler probably does (or at least can do) literal string 
concatenation at parse time.

-- 
Posted via http://www.ruby-forum.com/.