From: daz Date: 2003-09-13T22:40:39+09:00 Subject: Re: order of evaluation for method arguments "ts" wrote: > >>>>> "d" == daz writes: > > d> "Michael Garriss" wrote: > > >> a = [1,2,3,4,5] > --> [1, 2, 3, 4, 5] > >> b = [a.shift,a.shift,a.shift,a.shift,a.shift] > --> [1, 2, 3, 4, 5] > >> > > d> Well, since: > > d> a, b = b, a > > d> is 'defined' (in the sense that it's a ruby idiom), > d> your example works the way I'd expect, even though > d> Matz has guarded his options. > > I don't see the relation between the two. > > The first modify `a' in the RHS, the second not. > > Perhaps, it can exist a version of ruby which give > > b = [5, 4, 3, 2, 1] > > and where > > a, b = b, a > > still work > > > Guy Decoux > > I defer, of course ;) I was merely trying to convey that Ruby evaluates all RHS (in sequence) before assigning to LHS and it's no accident (indeed sensible) that: r = [1,2,3] a, b = r.shift, r.shift p [a, b] #-> [1, 2] daz