Issue #5694 has been updated by Marc-Andre Lafortune.


Hi,

Yukihiro Matsumoto wrote:
> We are not going to add incompatible changes to trunk, ...

Could you please explain to me what difference you see between an "incompatible change" and any "bug fix"?

Every bug fix will change some output under some circumstances. It's always possible to make a program that works before a bug fix is applied and that doesn't after the bug is fixed. This doesn't warrant the term "incompatible change", though.

As I've tried to detail my evaluation criteria, if there is no sign of intent, I do not consider it an "incompatible change". Noone has shown any sign of intent with respect to the arity bug. What justification do you have to call this an "incompatible change"?

>  Don't emphasize "official" too much.  Historically "official"
>  documentation has not been written by the original author (me) nor
>  implementer of the feature, so that it had often been written from
>  guessing from the code.

I agree that if the documentation doesn't state some behavior, no emphasis should be made.

I will continue to emphasize it when it does specify something, though. Thousands of people have read the reference documentation, have built an understanding of the Ruby language from what is says and written code according to it.

That we like it or not, the documentation is a kind of contract with the community and my understanding is that we try avoid changing that contract when possible.

Moreover, if there is any remaining doubt that the fault somehow lies in the documentation, it is clear from r759 (eval.c, see https://github.com/ruby/ruby/commit/1199a7d3d ) that the documentation for Method#arity is faithful to the intentions of the implementor.

We've had #arity return -n-1 whenever there are optional arguments or "rest" arguments for the past 11 years. I'm honestly still surprised I even have to convince anyone and that a discussion is needed. This is the big lesson I'll get from this; I will try not to assume that obvious bug fixes are obvious anymore.


----------------------------------------
Bug #5694: Proc#arity doesn't take optional arguments into account. 
http://redmine.ruby-lang.org/issues/5694

Author: Marc-Andre Lafortune
Status: Open
Priority: Normal
Assignee: Yukihiro Matsumoto
Category: core
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