Brian Candler wrote: > On Wed, Nov 12, 2008 at 06:01:40PM +0900, Brian Candler wrote: > >> However I'm not sure what should happen for methods defined from blocks, >> e.g. define_method(:foo) { |a,(b,c)| ... } >> > > Hmm. > > class Foo > define_method(:foo) { |a,(b,c)| p a,b,c } > end > > Foo.new.foo(1,[2,3]) > puts "Arity: #{Foo.new.method(:foo).arity}" > > So foo has an arity of 2. But if you pass anything other than a two-element > array for the second argument, you get an ArgumentError: wrong number of > arguments. > > This suggests to me that the arguments structure needs to be nestable; the > second argument is itself an argument list. > > I question the validity of Arity for this case since the arity is really 3. The nested nature will definitely be needed: class Foo define_method(:foo) { |a,(b,(c))| p a,b,c } end -Tom