[#57574] [ruby-trunk - Feature #8976][Open] file-scope freeze_string directive — "akr (Akira Tanaka)" <akr@...>

70 messages 2013/10/02

[#57579] [ruby-trunk - Feature #8977][Open] String#frozen that takes advantage of the deduping — "sam.saffron (Sam Saffron)" <sam.saffron@...>

25 messages 2013/10/02

[#57679] [ruby-trunk - Feature #8987][Open] map/collect extension which handles arguments — "sowieso (So Wieso)" <sowieso@...>

16 messages 2013/10/05

[#57705] [ruby-trunk - Feature #8992][Open] Use String#freeze and compiler tricks to replace "str"f suffix — "headius (Charles Nutter)" <headius@...>

43 messages 2013/10/07

[#57727] [ruby-trunk - Feature #8998][Open] string keys for hash literals should use fstrings — "normalperson (Eric Wong)" <normalperson@...>

17 messages 2013/10/08

[#57771] [ruby-trunk - Bug #9008][Open] TestProcess#test_clock_getres_constants and TestProcess#test_clock_gettime_constants fails on ARM — "vo.x (Vit Ondruch)" <v.ondruch@...>

15 messages 2013/10/09

[#57888] [ruby-trunk - Feature #9025][Open] Clarify the error message when calling a method with the wrong number of arguments — Nerian (Gonzalo Rodríguez) <siotopo@...>

11 messages 2013/10/15

[#57993] [ruby-trunk - Feature #9047][Open] Alternate hash key syntax for symbols — "jamonholmgren (Jamon Holmgren)" <jamon@...>

13 messages 2013/10/23

[#58007] [ruby-trunk - Feature #9049][Open] Shorthands (a:b, *) for inclusive indexing — "mohawkjohn (John Woods)" <john.o.woods@...>

25 messages 2013/10/24

[#58033] [ruby-trunk - Bug #9053][Open] SSL Issue with Ruby 2.0.0 — "tisba (Sebastian Cohnen)" <ruby-lang@...>

16 messages 2013/10/25

[#58080] [ruby-trunk - Feature #9064][Open] Add support for packages, like in Java — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

23 messages 2013/10/30

[ruby-core:57761] [ruby-trunk - misc #8993] Request for clarification on method argument binding for keyword arguments

From: "97jaz (Jon Zeppieri)" <zeppieri@...>
Date: 2013-10-09 05:03:29 UTC
List: ruby-core #57761
Issue #8993 has been updated by 97jaz (Jon Zeppieri).


I don't believe that's true. In the above example, f:5 is not being used as a keyword argument. It's being bound to e, the mandatory formal that comes after the optional ones. What JRuby's interpreter does now is what #8040 says it should do (at, least, so far as I understand #8040). For any argument to be considered a keyword argument, the number of arguments provided to a method needs to be greater than the number of mandatory arguments. In the example above, the method accepts three mandatory arguments, and the call provides three, so none of them are treated as keyword arguments. MRI, on the other hand, does treat f:5 as a keyword argument.
----------------------------------------
misc #8993: Request for clarification on method argument binding for keyword arguments
https://bugs.ruby-lang.org/issues/8993#change-42362

Author: 97jaz (Jon Zeppieri)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: 


=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



-- 
http://bugs.ruby-lang.org/

In This Thread