From: Mauricio Fernandez Date: 2006-05-07T16:34:54+09:00 Subject: Re: Proc#arity bug? On Sun, May 07, 2006 at 01:11:44PM +0900, Logan Capaldo wrote: > On May 6, 2006, at 11:03 PM, polypus wrote: > >p = proc {} > >p.arity -> -1 > > > >shouldn't that be returning 0? > > > >btw p = proc { |*a| } gives me -1 like it should. > > > >ruby 1.8.4 (2005-12-24) [i686-linux] > > It's not a bug it's a feature: > > proc { || } has arity 0, proc {} takes any number of args and ignores > them. Note that lambda{}.arity == 0 in 1.9: RUBY_VERSION # => "1.9.0" RUBY_RELEASE_DATE # => "2006-05-01" lambda{ }.arity # => 0 lambda{}.call(1,2,3) # ~> -:4: wrong number of arguments (3 for 0) (ArgumentError) # ~> from -:4 -- Mauricio Fernandez - http://eigenclass.org - singular Ruby