From: Todd Benson Date: 2008-12-13T07:43:16+09:00 Subject: Re: parallel method return value On Fri, Dec 12, 2008 at 4:12 PM, Louis-Philippe wrote: >> Now, you want a to be 1, but Ruby would need the power to read minds to >> accommodate that. See, because if I do the same, I want a to be [1, 2, 3]. >> How is foo supposed to figure that out? Or why should your want be more/less >> preferable than my want? >> > > You're totally right Matthew, I was twisted into thinking assignment would > do it for one lvalue with multiple rvalues... > Its probably a crazy idea, and who am I to have idea about language design > without any means to implement them... > but anyway, here's my thought (its this one that got me twisted). > Since the splat operator does nothing when preceding a rvalue of only one > array, like in: > > a = *[1,2,3] # => a = [1,2,3] > a = [1,2,3] # => a = [1,2,3] > > a,b = *[1,2,3] # => a = 1, b = 2 > a,b = [1,2,3] # => a = 1, b = 2 > > It would be in line with its normal use, to make all array items absolutely > separate, > allowing for the impossible: a = *[1,2,3] # => a = 1 (I know, this is > not working code, but thats how my head go previously twisted). > ... I was just thinking out loud, I believe there is certainly a really good > logic to explain why this fabulous language doesn't already implement this > feature, it surely won't stop me in my unconditional ruby love ;) > > L-P Perhaps bring your interests to the ruby core list. I like it the way it is. Ruby's parser assumes you require a single object unless the left hand side is specified otherwise. I see no weirdness about this. Todd