Actions
Misc #19971
openConfusing arity of a Proc with implicit rest parameter
Misc #19971:
Confusing arity of a Proc with implicit rest parameter
Status:
Open
Assignee:
-
Description
I've noticed that such proc proc { |a,| }
has arity 1
:
proc { |a,| }.arity # => 1
that means only one required parameter, but the proc behaves similar to a proc with explicit rest parameter (proc { |a, *| }
) that has arity -2
:
proc { |a, *| }.arity # => -2
that means one required parameter and rest parameter.
So I am wondering whether it's intentional behaviour and what the rational is behind it.
Actions