From: gotoken@... (GOTO Kentaro) Date: 1999-05-17T20:09:10+09:00 Subject: [ruby-talk:00321] Re: Arity features for Proc object? In message "[ruby-talk:00320] Re: Arity features for Proc object?" on 99/05/17, Yukihiro Matsumoto writes: >Well, well, I opened eval.c to see how hard to implement arity and >arugument check for block evaluation, and then spent about 1 hour, now >you see, it's done. :-) I've done already?? How quick your hack is!! >I defined two methods, Proc#arity, and Method#arity, which return the >number of required arguments for the Proc and Method objects. If they >accepts variable number of arguments, the arity return negative number. Great! it seems suitable spec. Is to use Method#arity as follows?? # obj.method(:method_name).arity # e.g. "a".method(:concat).arity #=> 1 (correct?) > proc = Proc.new{|i,| ..} # explicitly declare single argument > proc.call(a,b) Well, Is this feature - camma-trailing block parameter - documented anywhare?? >and > > proc = Proc.new{|i,j| ..} # more than two arguments > proc.call(a,b,c) > >will cause ArgumentError exception, just like methods. >I think it does not break any existing code. I see. It is very what I want. tons of thanks!! -- gotoken