Seebs wrote:
···
On 2009-12-31, Albert Schlef <albertschlef@gmail.com> wrote:
So it seems Ruby internally recognizes some structures as "statemenets"
and others as "expressions". It seems disapointing at first, but since
Ruby supports precedence for operators (something Lisp doesn't), there
has to be some price to pay.I don't think that's it at all. I think it's that methodname( is a
method
call (), not a grouping (). Thus the difference between
puts(a or b)
and
puts (a or b)In short, it's nothing to do with statements-vs-expressions, and
everything
to do with disambiguating method calls vs. parenthesized expressions.
Interesting.
Why is the following a syntax error?
puts (123 if true)
and the following isn't?
puts (123 or 456)
--
Posted via http://www.ruby-forum.com/\.