From: "David A. Black" Date: 2004-08-20T22:22:37+09:00 Subject: Re: splat behavior with different versions of ruby On Fri, 20 Aug 2004, David A. Black wrote: > Hi -- > > On Thu, 19 Aug 2004, Brett Williams wrote: > > > This is probably common knowledge, but the references I could find where > > annotated only in Japanese so I'm just not sure what is happening here: > > [code examples] > > > So out of 1.6.8, 1.7.2, 1.8.0, and 1.8.1, only 1.8.1 exhibits the > > behavior that I find counterintuitive. Is this the way it is supposed > > to work? If so, what is the rationale? > > There's a little bit on what might be a related topic at > , and I > think there's been some discussion on ruby-core. > > Here are what amount to some annotated notes to myself, which I hope > are reasonably accurate in their explanations. I'm definitely still > working my way through this. These are all 1.8.1. Oh, and to answer your question... :-) lambda {|*items| ... } .call(['foo',56]) *items is ['foo',56], and is also "that which, when wrapped in an array, is items" -- which means that items is ['foo',56] wrapped in an array: [['foo',56]]. Hence items[0] is ['foo',56], and items[1] is uninitialized. David -- David A. Black dblack@wobblini.net