Semantics of << and <<-
- From: Anders Höckersten <chucky@xxxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 23:12:51 +0900
Hi,
I recently joined this list, so please forgive me if this question has
been asked recently. I am wondering about the precise semantics of <<
and <<-. "Programming Ruby"[1] and the pseudo-BNFs[2][3] say that you
can use a quoted string after <<. As I see it, this means I should be
able to able to use the #{expr} construct inside this string, like this:
print <<"#{2+2}"
foobar
#{4}
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
.
- Follow-Ups:
- Re: Semantics of << and <<-
- From: Robert Klemme
- Re: Semantics of << and <<-
- Prev by Date: Re: Spread binaries for Ruby Windows
- Next by Date: Re: Method behaves differently when called using #send
- Previous by thread: Spread binaries for Ruby Windows
- Next by thread: Re: Semantics of << and <<-
- Index(es):