3 ms·
Except you don't. [1,2,3].collect{|x,y,z| ... } is perfectly valid ruby if "..." is an expression that does not blow up when y and z are nil. Likewise [[1,2,3
by vidarh 8y ago
Except you don't. [1,2,3].collect{|x,y,z| ... } is perfectly valid ruby if "..." is an expression that does not blow up when y and z are nil.
Likewise
[[1,2,3]].collect{|x,y| [x,y]}
is perfectly valid even though 3 will not get assigned to anything.
So you're being forced to spell out which arguments you want to be able to reference, which is probably related to what it will get passed, but not required to be.
So if you don't know how many parameters there will be, you're in trouble either way.