give me a
"NameError: undefined local variable or method `x' for main:Object",
yet
a = x = 1 ; b = y = 2;
or
a,b = (x,y = 1,2)
seem to work fine. It doesn't really bother me since the
workarounds are easy, but the first one looks cleaner to me.
Would this still be an error in Ruby2?
give me a
"NameError: undefined local variable or method `x' for main:Object",
yet
a = x = 1 ; b = y = 2;
or
a,b = (x,y = 1,2)
seem to work fine. It doesn't really bother me since the
workarounds are easy, but the first one looks cleaner to me.
It's a bit over-cleaned in this case It's parsed as:
(a,b) = x,(y=1),2
Would this still be an error in Ruby2?
Matz has discussed possibly changing multiple assignment, but I think
in a case like this the rules would still be the same. That's
actually good -- we want y=1 to mean y=1