Project

General

Profile

Actions

Feature #8088

open

Method#parameters (and friends) should provide useful information about core methods

Added by headius (Charles Nutter) about 11 years ago. Updated about 1 year ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:53386]

Description

I was wiring up #parameters to work for native methods today when I realized MRI doesn't give very good information about variable-arity native methods:

$ ruby2.0.0 -e "p ''.method(:gsub).to_proc.parameters"
[[:rest]]

$ jruby -e "p ''.method(:gsub).to_proc.parameters"
[[:req], [:opt]]

I think MRI should present the same as JRuby here; gsub is obviously not a rest-arg method and you can't call it with less than 1 or more than 2 arguments. JRuby's presenting the right output here.

I'm probably going to have to change JRuby to do the less-helpful version so we're compliant and tests pass, but I think the specification of #parameters should be that it presents the JRuby version about rather than the MRI version.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0