Syntax error with array interpolation


#1

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


#2

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.