From: dblack@... Date: 2007-02-16T03:43:33+09:00 Subject: Re: is it behaving strange ? Hi -- On Fri, 16 Feb 2007, Robert Dober wrote: > Well I cannot speak for OP but what puzzles me is > > a=[42] # sorry 9 is not the number ;) > *a ==> error # gotta check with 1.9 an 2.0 at home > > I would think that this expression can/could/should/might perfectly > evaluate to 42 look at this other oddity the following code is > completely legal and POLS(1) > def x *args > return *args > end > (1) in the sense that a,b,c = x 1,2,3 sets a to 1, b to 2 and c to 3 > and x is a NOP > > but return in the last statement is optional, or is it not ;) I know > you are not falling into my trap ! > > I see no reason however why > def x *args > *args > end > should not be legal I can't think of a case where you'd need it, since the arguments would just get wrapped up in an array anyway. Also, *args is basically equivalent to a bare list, and you can't do: def x 1,2,3 end David -- Q. What is THE Ruby book for Rails developers? A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black) (See what readers are saying! http://www.rubypal.com/r4rrevs.pdf) Q. Where can I get Ruby/Rails on-site training, consulting, coaching? A. Ruby Power and Light, LLC (http://www.rubypal.com)