From: Jakub Travnik Date: 2001-12-14T05:26:40+09:00 Subject: [ruby-talk:28450] Re: why is Proc's arity function so weird? Chr. Rippel wrote: >>>From the Pickaxe book (online, since the printed version is wrong, as is >>the online description of Proc#arity): >> Proc.new {||}.arity � 0 >> Proc.new {|a|}.arity � -1 >> Proc.new {|a,b|}.arity � 2 >> Proc.new {|a,b,c|}.arity � 3 >> Proc.new {|*a|}.arity � -1 >> Proc.new {|a,*b|}.arity � -2 >> > Add this to your list > > Proc.new {||}.arity � 0 > Proc.new {|a,|}.arity � 1 > Proc.new {|a,b,|}.arity � 2 > Proc.new {|a,b|}.arity � 2 > Proc.new {|a,b,c,|}.arity � 3 > Proc.new {|a,b,c|}.arity � 3 > > ..... > Proc.new {|a|}.arity � -1 > Proc.new {|*a|}.arity � -1 > Proc.new {|a,*b|}.arity � -2 > Proc.new {|a,b,*c|}.arity � -3 > > /Christoph and the most inconsistent imho is: Proc.new {}.arity #=> -1 Why should Proc object take any number of arguments in call when none of them are used? Jakub Travnik jabber://jtra@jabber.com