[#1026] Is this a bug? — Dave Thomas <Dave@...>

18 messages 2000/01/03

[#1084] Infinite loop — Dave Thomas <Dave@...>

17 messages 2000/01/11

[#1104] The value of while... — Dave Thomas <Dave@...>

24 messages 2000/01/11

[ruby-talk:01049] Re: Extract args from binding?

From: matz@... (Yukihiro Matsumoto)
Date: 2000-01-04 15:11:36 UTC
List: ruby-talk #1049
Hi,

In message "[ruby-talk:01048] Extract args from binding?"
    on 00/01/04, Andrew Hunt <andy@Toolshed.Com> writes:

|Is there an easy way in Ruby to get the arguments of the function
|from a binding?  (In the C code, this would be the argc,argv from the
|frame within the binding.)  How can I access that from Ruby?

Hmm, there's no easy way.
Maybe adding some method to Binding object would work.

BTW, Proc and Method objects have `arity' method to tell number of
formal arguments.

  p self.method("foobar").arity

Negative number means number of required argument in 1's complement.
it's not always informative, because almost all method with variable
number of arguments which is defined in C, reports -1.

							matz.

In This Thread

Prev Next