Matz wrote in post 51530 (“Where Is Method Call Precedence?”) that the dot
is the strongest operator. To me that means that 1.6.7 parsing is wrong and
1.7.2 parsing of the expression is correct.
It is very surprising to me that this would require parenthesis.
···
Kent Dahl wrote on Friday, September 27, 2002 1:44 PM > Dale Martenson wrote:
puts (1…4).sum
This seems to work with Ruby version 1.7.2 (Windows),
But should give warning with -w, IIRC:
warning: (…) interpreted as grouped expressionbut not with version
1.6.7 (Cygwin).Old parsing of the above code is as:
(puts (1…4)).sumEither way, puts (anything).anything_else is a bad idea in general.
Put the parenthesis in explicity.