Forum: Ruby Syntax error with array interpolation

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C667185722eaecf12461cb423dc8b410?d=identicon&s=25 Ronald Fischer (Guest)
on 2007-06-25 16:36
(Received via mailing list)
Below is a code snippet which gives me some headache:

def headache
  yield(*(foo(1)),"bar")
end

def foo(n)
  [n,n+2,n+5]
end

headache { |a,b,c,d| puts a.to_s; puts b.to_s; puts c.to_s; puts d }

I had expected that this would print
0ec4920185b657a03edf01fff96b4e9b?d=identicon&s=25 Yukihiro Matsumoto (Guest)
on 2007-06-25 17:03
(Received via mailing list)
Hi,

In message "Re: Syntax error with array interpolation"
    on Mon, 25 Jun 2007 23:35:11 +0900, "Ronald Fischer"
<ronald.fischer@venyon.com> writes:

|Below is a code snippet which gives me some headache:

1.8 allows argument splat (*) only at the end of argument list.
Wait for 1.9.

              matz.
This topic is locked and can not be replied to.