2012/9/9 headius (Charles Nutter) <headius / headius.com>:

> But this isn't consistent either, since the single-argument form does not spread arrays:
>
> system ~/projects/jruby $ ruby-1.9.3 -e "def foo; yield *[[1]]; end; foo {|a| p a}"
> [1]
>
> system ~/projects/jruby $ ruby-1.9.3 -e "def foo((a)); p a; end; foo *[[1]]"
> 1
>
> So it spreads an incoming array out when there's more than one receiving argument, but does not spread it out when there's only one receiving argument?

Single array expansion is not always performed.
It depends on the form of the block arguments.

As you said, {|a| } doesn't expand.
If {|a| } expands an array, we cannot get an element of a nested array in
[ary, ary, ...].each {|a| ... }.

Also, {|*a| } doesn't expand.
If {|*a| } expands an array, we cannot pass block arguments as-is
using {|*a| yield *a }.

I wrote about this design in [ruby-dev:38795].  It is written in
Japanese, though.
-- 
Tanaka Akira