Hello, thanks so much for MRuby!
I'm currently investigating some behavior in Proc#parameters (from mrbgems/mruby-proc-ext), and believe I may have spotted a bug (or else I am unaware of the expected behavior). Here is a file that reproduces my issue (I put it in a test project under e.g. mrblib/bug_example.rb):
class BugExample
def all_method(reqp, optp=nil, *restp, keyreqp:, keyp: nil, **keyrestp, &blockp)
Invocation::Binding.get
end
end
example = BugExample.new
puts example.method(:all_method).parameters.inspect
When I run the above code, with mruby-proc-ext (and mruby-io, for #puts), I see the following output:
[[:req, :reqp], [:opt, :optp], [:rest, :restp], [:block, :keyrestp]]
This indicates that the **keyrestp parameter has been interpreted as a block parameter. I'm not sure how keyword arguments are handled internally by MRuby, but I believe the expected output is this:
[[:req, :reqp], [:opt, :optp], [:rest, :restp], [:keyreq, :keyreqp], [:key, :keyp], [:keyrest, :keyrestp], [:block, :blockp]]
I'm not sure how mruby-proc-ext is supposed to work with keyword arguments. I have discovered that the keyword arguments appear to be placed in the stack after the block argument (and mrb->c->ci->argc does not indicate their presence; only ci_nregs in src/vm.c, line 405).
I am very new to MRuby, though, so I realize I may be in error here.
Hello, thanks so much for MRuby!
I'm currently investigating some behavior in
Proc#parameters(frommrbgems/mruby-proc-ext), and believe I may have spotted a bug (or else I am unaware of the expected behavior). Here is a file that reproduces my issue (I put it in a test project under e.g.mrblib/bug_example.rb):When I run the above code, with
mruby-proc-ext(andmruby-io, for#puts), I see the following output:This indicates that the
**keyrestpparameter has been interpreted as a block parameter. I'm not sure how keyword arguments are handled internally by MRuby, but I believe the expected output is this:I'm not sure how
mruby-proc-extis supposed to work with keyword arguments. I have discovered that the keyword arguments appear to be placed in the stack after the block argument (andmrb->c->ci->argcdoes not indicate their presence; onlyci_nregsinsrc/vm.c, line 405).I am very new to MRuby, though, so I realize I may be in error here.