On 9/7/2010 12:36 PM, Aaron Sherman wrote:
Oddly, these two expressions have the same output:
for 0 ...^ (3+4) -> $i { say $i }
for 0 ...^ 7 -> $i { say $i }
But this one prints the numbers 0 through 7 instead of leaving off the last
number:
for 0 ...^ 3+4 -> $i { say $i }
It does the same with or without the ^ so it's like it's just ignoring the ^
in the case above.
The parser obviously binds ^ tighter than + which binds tighter than ...
so this parses as
for 0 ...((^ 3)+4) -> $i { say $i }
^3 (which is the same as 0...2) numifies as its length 3 so that makes
this the same as
for 0 ...7 -> $i { say $i }
so as long as those are the right precedence levels for those operators
this is not a bug
Mark Biggar
--
m...@biggar.org
mark.a.big...@comcast.net