From: merch-redmine@... Date: 2020-02-22T00:06:50+00:00 Subject: [ruby-core:97236] [Ruby master Misc#16645] Non-warned change of behavior in 2.7 for non-symbol keys Issue #16645 has been updated by jeremyevans0 (Jeremy Evans). Status changed from Open to Rejected Yes, treating non-Symbol keys as keywords if the method accepts arbitrary keywords is expected behavior, as mentioned in the Ruby 2.7.0 release notes (https://www.ruby-lang.org/en/news/2019/12/25/ruby-2-7-0-released/). This is a deliberate change from previous versions. There are various related cases using non-arbitrary keywords or hashes where Ruby will warn and treat this as a positional argument: ```ruby def a(*a, b: 1) [a, b] end a("a"=>1) # (irb):2: warning: Passing the keyword argument as the last hash parameter is deprecated # (irb):1: warning: The called method `a' is defined here # => [[{"a"=>1}], 1] a("a"=>1, b: 1) # (irb):3: warning: Splitting the last argument into positional and keyword parameters is deprecated # (irb):1: warning: The called method `a' is defined here # => [[{"a"=>1}], 1] a({"a"=>1}) # => [[{"a"=>1}], 1 # No warning or attempt to convert to keywords ``` ---------------------------------------- Misc #16645: Non-warned change of behavior in 2.7 for non-symbol keys https://bugs.ruby-lang.org/issues/16645#change-84343 * Author: Dan0042 (Daniel DeLorme) * Status: Rejected * Priority: Normal ---------------------------------------- In ruby 2.7 non-symbol keys are now accepted as keywords, resulting in the following change in behavior: ```ruby def foo(*a,**h) p [a,h] end foo("a"=>42) # [[{"a"=>42}], {}] in 2.6 # [[], {"a"=>42}] in 2.7 ``` Given that the general plan for 2.7 was to be backward compatible while warning about upcoming changes, I just wanted to confirm if it was ok to change this _without a deprecation phase_? I couldn't find any reference or discussion about this in the dev meeting logs. -- https://bugs.ruby-lang.org/ Unsubscribe: