On Sat, 2004-09-25 at 09:59, Brian Candler wrote: > I support all that you have written, as I have been bitten by this > inconsistency in the past (in a less serious way than you). > [snip] > So perhaps all we need to do, for ruby-2.0 at least, is keep this mechanism > and get rid of the rule which says "if single argument is an array then > auto-expand it" completely. That was my conclusion as well. > (3) It may be possible to keep Ruby's automagic exploding of arguments, if > we limit it to cases where there is no ambiguity. I am thinking of: > > - the sender passes a single array value; > - the receiver REQUIRES two or more arguments. > > This is unlike def foo(head,*rest) or proc {|head,*rest| ... }, where it can > take _one_ or more arguments, so the rule would not apply. > > This might be a solution for 1.8.2, where you want to be backwards > compatible. At least, Hash#each { |key,value| ... } would continue to work. > But it still wouldn't be consistent, unless you also applied it also to > method calls (which would be dubious, IMO) I played around with this idea (briefly) yesterday before posting. I reached the (tentative) conclusion that any attempt to retain auto-explosion and enforce consistency would blow up. The goatch for this one: if a method required two arguments and was passed an array by some user, changing the method so that the second argument was optional would (instead of required) would silently change what was passed in for the second argument--it would now get the array, and the second would get the default. You can move the problem around, but getting rid of implicit array explosion entirely seems to be the only cure. -- Markus