Issue #5694 has been updated by Yukihiro Matsumoto.

Status changed from Assigned to Rejected

We are not going to add incompatible changes to trunk, unless we see consensus after discussion. I think this is not the case. Currently and for near future, arity ignores optional arguments.  Use #parameters or propose new API like #arity_range (in a separate proposal).
----------------------------------------
Bug #5694: Proc#arity doesn't take optional arguments into account. 
http://redmine.ruby-lang.org/issues/5694

Author: Marc-Andre Lafortune
Status: Rejected
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: 
Target version: 
ruby -v: -


Currently:

    ->(foo = 42){}.arity # => 0, should be -1

This is contrary to the documentation and to what we should expect from the equivalent method definition.

Fixed in trunk, requesting backport for the 1.9 line.



-- 
http://redmine.ruby-lang.org