From: Michael Garriss Date: 2003-09-13T13:43:15+09:00 Subject: Re: order of evaluation for method arguments Michael Garriss wrote: > Is this code guaranteed to always work this way: > > a = [1,2,3,4,5] > --> [1, 2, 3, 4, 5] > def m( a, b, *c ) > puts a, b, c > end > --> nil > m( a.shift, a.shift, a ) > 1 > 2 > 3 > 4 > 5 > --> nil > > I'm wondering (hoping) that the arguments will always be evaluated > from left to right as is the case above. Is this a 'ruby rule' or > something that could change? > Let me extend the question to include arrays (which might be related to arguments, I don't know, I've never looked at the ruby source): 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] Michael