Hi, this seems inconsistent to me:
irb(main):005:0> Proc.new {|a|}.arity
=> -1
irb(main):006:0> Proc.new {|a,|}.arity
=> 1
irb(main):007:0> Proc.new {|a,b|}.arity
=> 2
irb(main):008:0> Proc.new {|a,b,|}.arity
=> 2
Is there any reason why the single argument case has special
processing?
In the first case, if the proc is called with more than one argument
’a’ will get an array.
In the third case only two args are allowed - no different from case
4.
But should it not be that case 3 can have one or more args (arity =
-2)?
Yes, you can always do what you want with * args, but it seems
inconsistent.
/haldane