Bug #574
closedProc.new{}.arity is equal to -1 instead of 0
Description
=begin
In the ruby documentation for the versions 1.8.6, 1.8.7 and 1.9 is written about the method Proc#arity:
Proc.new {}.arity #=> 0
Proc.new {||}.arity #=> 0
Proc.new {|a|}.arity #=> 1
...
But in my scripts Proc.new{}.arity is equal to -1 and Proc.new{||}.arity is equal to zero.
The script attached to this issue shows the problem. I have tested it in my Linux box (Ubuntu hardy 8.04LTS architecture: i686 ) using both:
- ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
- ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
Here the output:
$ ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux]
$ ruby proc_arity.rb
-1
0
1
2
3
$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
$ ruby proc_arity.rb
-1
0
1
2
3
Where is the problem? It's a ruby's bug or a documentation one?
=end
Files
Updated by shyouhei (Shyouhei Urabe) almost 16 years ago
- Assignee set to knu (Akinori MUSHA)
=begin
=end
Updated by nobu (Nobuyoshi Nakada) almost 16 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
Applied in changeset r22979.
=end