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.
Ronald F. (Guest)
on 2007-06-25 18: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
Yukihiro M. (Guest)
on 2007-06-25 19:03
(Received via mailing list)
Hi,

In message "Re: Syntax error with array interpolation"
    on Mon, 25 Jun 2007 23:35:11 +0900, "Ronald F."
<removed_email_address@domain.invalid> 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.