In message "[ruby-talk:01440] The return value of Method.arity"
on 00/02/16, Dave Thomas <Dave / thomases.com> writes:
|I'm trying to come to grips with Method.arity. My understanding is
|that it returns the following
|
| c language methods: n mandatory arguments +n
|
| n arguments including some -n
| that are optional
|
| attribute setters 1
|
| Ruby methods n arguments -n-1
|
| n arguments including an -n
| array or block
|
|Is this correct?
Oops, it is a bug. That should not be clear difference between C
methods and Ruby methods. It should be
methods: n mandatory arguments +n
n mandatory arguments + optional -n-1
But C methods have no information about number of mandatory arguments,
so that arity for all C methods with any optinal arguments return -1.
matz.