David A. Black wrote: > On Wed, 1 Dec 2004, Robert Klemme wrote: >>"Brian Schröäer" <ruby / brian-schroeder.de> schrieb >>>*[:x] => :x >>No, it does not pack / unpack an array. You can only use it in a >>situation where there is an assignment. The star indicates, that a given >>value should be enumerated and assigned to lvalues in order (this applies >>also to method argument lists). > > It doesn't have to be an assignment; you can do: > > irb(main):003:0> [1,2,*[3,4]] > => [1, 2, 3, 4] I think this is just another case of a hidden method call. I like to think of [1, 2, 3] as Array[1, 2, 3] which is Array.[](1, 2, 3) So maybe that sample could be thought of as Array.[](1, 2, *Array.[](3, 4)) -- isn't Ruby an oddly lovable language? :) > or: > > irb(main):004:0> arr = [1,2,3,4] > => [1, 2, 3, 4] > irb(main):005:0> Hash[*arr] > => {1=>2, 3=>4} > > I like to think of it as the unarr?ay (unary/unarray) operator :-) Same here, equivalent to Hash.[](1, 2, 3, 4). So I guess the theory of the original poster (* interpolates an Array into an assignment list) still holds true.