gotoken / math.sci.hokudai.ac.jp (GOTO Kentaro) writes:

>   lambda{|a|}.call   expects zero or more arguments. 
>   lambda{|a,|}.call  expects just one argument. 
>   lambda{||}.call    expects zero arguments. 

Most likely this has been discussed in the past.  But why is the parameter
arity mechanism for procs different from that of methods?

def m0      ()
def m1      (a)  
def m2      (a,b)
def m_vary  (*a)

Ruby strictly checks the arity of the above for 0, 1, 2 and  any respectively.
Why don't procs follow the same:

proc {|| ...}       0
proc {|a| ...}      exactly 1
proc {|*a| ...}     variable

why have proc {|*a| ...} and proc {|a| ...} mean the same?

[is there a subtle non-obvious difference?
      proc {|*a| puts 'hi'; printf ">%s<\n", a}.call 1,2,3
      proc {|a|  puts 'hi'; printf ">%s<\n", a}.call 1,2,3
 seem to give same answers for various parameters]

and have to introduce something new for procs:
proc {|a,| ...} to mean exactly one ?

As with just about all things in Ruby there is probably a good reason, but i
don't seen it immediately.

Thanks,
Raja