Project

General

Profile

Feature #8088

Updated by Eregon (Benoit Daloze) over 1 year ago

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: 

 ``` 
 ext-jruby-local ~/projects/jruby $ ruby2.0.0 -e "p ''.method(:gsub).to_proc.parameters" 
 [[:rest]] 

 ext-jruby-local ~/projects/jruby $ 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.

Back