From: Daniel Lucraft Date: 2007-06-26T00:02:46+09:00 Subject: Re: Syntax error with array interpolation Ronald Fischer wrote: > Below is a code snippet which gives me some headache: > > def headache > yield(*(foo(1)),"bar") > end You can't use a 'splatted' array anywhere in a method call except at the end: def foo(a, b, c) p [a, b, c] end foo(1, 2, *[3]) #=> works foo(1, *[3], "asdf") #=> doesn't work I'm not quite sure why this should be, since it has an unambiguous meaning, unlike defining a method with a splat in the middle of the arguments: def bar(a, *b, c=0) ... end The splat operator is a bit mysterious to me in this regard..... best, Dan -- Posted via http://www.ruby-forum.com/.