Hi --

On Fri, 4 Nov 2005, Ron M wrote:

> This
>
>   a,b = x,y = 1,2
>
> 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 :-)


David

-- 
David A. Black
dblack / wobblini.net