On 10/12/06, Rick DeNatale <rick.denatale / gmail.com> wrote:
> Now under the current 1.9 none of these examples work, even _why's case trick.
I went back and checked, and _why's case trick for arrays does work under 1.9.
I'm still concerned about what this change in 1.9 does to EXPLICIT use
of the * operator.
I'd suggest that a more conservative change might be to continue to
use to_a for explicit splatting, i.e. when the * is actually coded,
and reserve implicit coercion via to_splat/to_values whatever for
cases like
def foo
return 1, 2, 3
end
a, b, c = foo
Also I'd argue that *expression should be allowable anywhere a list of
variables is allowed as a source of values, and that those should all
be handled consistently. These would be:
in an actual parameter list to a method.
in a series of values on the right hand side of a (parallel) assignment.
in the comparison list of a when clause in a case statement.
in the parameter list of a rescue clause
any more? I think that *expression can be used in all of these, but
it's not treated consistently in how the expression gets coerced to a
list of values.
--
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/