Hi --

On Fri, 16 Feb 2007, sur max wrote:

> def a *args
> *args
> end
> is very much illegal .... giving compile error
> and with return keyword it works very fine.
>
> I am still feeling that point(s) still lasts
>
> Again i am repeating the same old story ....
>
> *a = 9  # i like this number :)
> b = *a  # => 9  ------- mind it, it is Fixnum
> here it seems true "*x equals [x] without the []"
>
> a << 5
> b = *a # => [9,5] ------- an Array
> here it seems false "*x equals [x] without the []"

But you have to consider this:

   b = 9,5   # => [9,5]

so "[9,5] without a []", on the rhs, gets turned into an array.  I
know it sounds like I'm putting in an extra step... but it really is
consistent in terms of the behavior of * itself.

> moreover
> *a # => compile error
>
> is it strange behavior ? or pretty digestible ?   :)

What would that mean, though?  Or, to put it another way, what could
you possibly do with *a on its own?


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)