This is, however, not the way my installation of Ruby (1.8.1) works.
What I am wondering is, is this the expected behaviour and are both the
book and the pseudo-BNFs wrong, or is this some form of bug in the
interpreter?
Best regards,
Anders
[1] Programming Ruby, 2nd Edition, p. 321
[2] http://www.ruby-doc.org/docs/ruby-doc-
bundle/Manual/man-1.4/yacc.html
[3] http://www.ruby-lang.org/ja/man/?cmd=view;name=%B5%BF%BB%F7BNF%A4%CB
%A4%E8%A4%EBRuby%A4%CE%CA%B8%CB%A1
My guess would be that it's an omission in the documentation. I don't
think you can do interpolation in the string. Basically it's not a
Ruby string but an idendifier and the quotation announces differnt
behaviro. After all, what do you gain by a computed terminator of a
here document? I don't think that's useful.
See http://www.ruby-doc.org/docs/ProgrammingRuby/#UD
Kind regards
robert
Here's the correct link:
http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UD
The purpose of quoting the here-document label is to make the
text be treated as though it were enclosed in single quotes.
----------------------------------------------
puts <<'HERE'
#{3**3} bells.
HERE
puts <<"HERE"
#{3**3} bells.
HERE
puts <<HERE
#{3**3} bells.
HERE
------------------------------------------------
#{3**3} bells.
27 bells.
27 bells.