Peña, Botp wrote:
> ...
> 
> consistency perhaps?
> 
> r@pc4all:~# ruby -e 'def foo; return *[1]; end; p foo'
> 1
> r@pc4all:~# ruby -e 'def foo; return *[1,2]; end; p foo'
> [1, 2]
> 
> kind regards -botp

It seems somehow less consistent when viewed another way though. I think 
splatting a literal array should be equivalent to having written a plain 
comma-delimited list:

  def bar(*args); end

  bar 1
  bar(*[1])
  bar 1, 2
  bar(*[1, 2])

In which case, for return:

  return *[1]    => return 1    => 1
  return *[1, 2] => return 1, 2 => [1, 2]

Its not going to really bother me at any rate though.

-- 
Posted via http://www.ruby-forum.com/.