Project

General

Profile

Actions

Bug #8993

closed

Request for clarification on method argument binding for keyword arguments

Added by 97jaz (Jon Zeppieri) over 10 years ago. Updated over 10 years ago.

Status:
Closed
Target version:
-
ruby -v:
Backport:
[ruby-core:57706]

Description

=begin
I recently fixed keyword arguments in the JRuby interpreter, and I then found an example for which MRI and JRuby have different behavior:

def foo(a, b, c=1, *d, e, f:2, **g)
[a, b, c, d, e, f, g]
end

foo(1, 2, f:5)

MRI raises:
ArgumentError: wrong number of arguments (2 for 3+)

... whereas JRuby produces:

[1, 2, 1, [], {:f=>5}, 2, {}]

I implemented the behavior in JRuby to conform with MRI, but in this case, I think that JRuby's behavior is correct, based upon the discussion in #8040.

Is there a spec for this feature somewhere (aside from the RSpec specs that I submitted to the RubySpec project)? In #7529, Matz refers to "the spec" for this feature, but I don't know where or what that is.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0