|
Bugzilla – Full Text Bug Listing |
| Summary: | ruby-bindings: function parameter with default value cannot be parsed | ||
|---|---|---|---|
| Product: | [openSUSE] openSUSE 11.4 | Reporter: | Jiří Suchomel <jsuchome> |
| Component: | YaST2 | Assignee: | Josef Reidinger <jreidinger> |
| Status: | RESOLVED FIXED | QA Contact: | Jiri Srain <jsrain> |
| Severity: | Normal | ||
| Priority: | P3 - Medium | CC: | kkaempf, mvidner |
| Version: | Final | ||
| Target Milestone: | --- | ||
| Hardware: | Other | ||
| OS: | Other | ||
| Whiteboard: | |||
| Found By: | Development | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
I discussed this bug with Jiri during the workshop. The reason it happens is because the bindings use Method#arity when it should probably use Method#parameters (as detailed in the ruby-doc). Method#arity returns negative numbers when there are optional parameters and this causes the crash. So YCP should always call ruby passing _all_ parameters of a ruby method with optional arguments. Sadly, the advertised Merthod#parameters (http://www.ruby-doc.org/core/classes/Method.html#M001075) does not seem to be available in the interpreter. (In reply to comment #1) > > Sadly, the advertised Merthod#parameters > (http://www.ruby-doc.org/core/classes/Method.html#M001075) does not seem to be > available in the interpreter. Its a feature of Ruby 1.9 martin - When I checking this feature, does YaST support somehow optional parameters or parameter overloading, so I can create more versions of same call? In YCP, function overloading only works for built-ins, not for user defined functions. That's kind of stupid, having overloading implemented but keeping the user from using it in their APIs. We can fix that if we have a strong enough use case. (In reply to comment #6) > In YCP, function overloading only works for built-ins, not for user defined > functions. > > That's kind of stupid, having overloading implemented but keeping the user from > using it in their APIs. We can fix that if we have a strong enough use case. Well, this is one use case. Without it I cannot fix this bug, as it is hard to convert ruby optional parameters if ycp doesn't allow it with current ruby-bindings and new way how to export ruby code to component system, issue is no longer valid. |
module KerberosClient def self.read(params={}) ... end end ruby-bidnings does not correctly realize number of arguments: Y2DIR= LD_LIBRARY_PATH= /usr/bin/ycpc -c -M. -I. -q Kerberos.ycp ruby/YRubyNamespace.cc(YRubyNamespace):239 [Y2Ruby] going to parse signature: 'any( any)' ruby/YRubyNamespace.cc(YRubyNamespace):239 [Y2Ruby] going to parse signature: 'any( any)' ruby/YRubyNamespace.cc(YRubyNamespace):239 [Y2Ruby] going to parse signature: 'any( )' Kerberos.ycp:279 [Parser] Excessive parameter in call to KerberosClient::read(...)