On 2/17/07, Pe?a, Botp <botp / delmonte-phil.com> wrote:
> fr: sur max [mailto:sur.max / gmail.com]
> # definitely, it seems so natural using
> # = *a,b
>
> indeed, as robert pointed out.
> but the magic generally leans towards, producing (and thereby questioning) *a, like
>
> def x
>   *a
> end
>
> or
>
> def x
>    1,2,3
> end
>
> so what does *a produce, or 1,2,3? an array, a list, or an unarrayed array (to quote dblack)? those are just names, but what is it really, what are its properties/methods/etc?
>
> # and this gives the feel of ruby. isn't it  ?
>
> i'm not sure (because the magic tends to fall on hole, a cul de sac), maybe because i seldom use it, ... only matz knows.

Take a look at these

>> instruments = {'trombones' => 1, 'clarinets' => 2}
>> p instruments.to_a
[["trombones", 1], ["clarinets", 2]]
>> p *instruments
["trombones", 1]
["clarinets", 2]

Normally * uses to_a or to_ary, but certainly its more devious than it
appears. And where exactly is this operator defined in ruby source
tree? eval.c ?




-- 
gnufied
-----------
There was only one Road; that it was like a great river: its springs
were at every doorstep, and every path was its tributary.
http://people.inxsasia.com/~hemant