On 8/12/06, dblack / wobblini.net <dblack / wobblini.net> wrote:

> So *0..3 is almost like saying: you're a range, but pretend that
> you're a thing that can be un-arrayed, namely an array.  That seems to
> be the purpose of the * in this case -- to "trick" the range into
> thinking it's an array.
>
> If you look at ranges as array-like lists of values in the first place
> (which I don't), then it might make sense in a less convoluted way :-)

Or you can think of the * before the last rvalue in an assignment as a
signal to replace the rvalue with a series of rvalues obtained from
the elements of the array resulting from sending to_ary to the
original rvalue.

The original rvalue doesn't need to be an array, or a range, just
anything which responds to to_ary

And actually in Ruby 1.8, it looks like it can be any object, since it
seems to actually use to_a instead of to_ary which is defined in
Object to return an array containing the receiver.  But this is
supposed to change in Ruby 1.9

-- 
Rick DeNatale

IPMS/USA Region 12 Coordinator
http://ipmsr12.denhaven2.com/

Visit the Project Mercury Wiki Site
http://www.mercuryspacecraft.com/