From: Paul Brannan Date: 2003-11-27T23:52:08+09:00 Subject: arity of methods defined with define_method Why do I get the following arities: irb(main):005:0> [pbrannan@zaphod tmp]$ irb irb(main):001:0> RUBY_VERSION => "1.6.8" irb(main):002:0> class Foo; define_method :foo, proc {}; end => # irb(main):003:0> Foo.instance_method(:foo).arity => -135401849 irb(main):004:0> [pbrannan@zaphod tmp]$ irb-1.8 irb(main):001:0> RUBY_VERSION => "1.8.1" irb(main):002:0> class Foo; define_method :foo, proc {}; end => # irb(main):003:0> Foo.instance_method(:foo).arity => 1 In the first case I get a completely unexpected arity; I suspect this is a bug that was fixed in 1.8? In the second I get an arity of 1, but I can clearly call the method with 0 or 3 arguments: irb(main):004:0> Foo.new.foo() => nil irb(main):005:0> Foo.new.foo(1, 2, 3) => nil I would expect that a method that can take any number of arguments would have an arity of -1. Why is this not the case with methods defined with define_method()? Paul