ruby-changes:71630
From: Benoit <ko1@a...>
Date: Tue, 5 Apr 2022 18:42:18 +0900 (JST)
Subject: [ruby-changes:71630] d3f659d3f9 (master): Add NEWS entry for Bug #18625 to help adding ruby2_keywords in the missing places
https://git.ruby-lang.org/ruby.git/commit/?id=d3f659d3f9 From d3f659d3f94cc8cf8315e11f5d38b4c62c7f24ae Mon Sep 17 00:00:00 2001 From: Benoit Daloze <eregontp@g...> Date: Tue, 5 Apr 2022 11:36:32 +0200 Subject: Add NEWS entry for Bug #18625 to help adding ruby2_keywords in the missing places --- NEWS.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/NEWS.md b/NEWS.md index 00e9667603..b1a5791c84 100644 --- a/NEWS.md +++ b/NEWS.md @@ -59,6 +59,33 @@ Note that each entry is kept to a minimum, see links for details. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L59 * Find pattern is no longer experimental. [[Feature #18585]] +* Methods taking a rest parameter (like `*args`) and wishing to delegate keyword + arguments through `foo(*args)` must now be marked with `ruby2_keywords` + (if not already the case). In other words, all methods wishing to delegate + keyword arguments through `*args` must now be marked with `ruby2_keywords`, + with no exception. This will make it easier to transition to other ways of + delegation once a library can require Ruby 3+. Previously, the `ruby2_keywords` + flag was kept if the receiving method took `*args`, but this was a bug and an + inconsistency. [[Bug #18625]] [[Bug #16466]] + + ```ruby + def target(**kw) + end + + # Accidentally worked without ruby2_keywords in Ruby 2.7-3.1, ruby2_keywords + # needed in 3.2+. Just like (*args, **kwargs) or (...) would be needed on + # both #foo and #bar when migrating away from ruby2_keywords. + ruby2_keywords def bar(*args) + target(*args) + end + + ruby2_keywords def foo(*args) + bar(*args) + end + + foo(k: 1) + ``` + ## Command line options ## Core classes updates @@ -203,6 +230,7 @@ The following deprecated APIs are removed. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L230 [Feature #15357]: https://bugs.ruby-lang.org/issues/15357 [Bug #15928]: https://bugs.ruby-lang.org/issues/15928 [Feature #16131]: https://bugs.ruby-lang.org/issues/16131 +[Bug #16466]: https://bugs.ruby-lang.org/issues/16466 [Feature #16806]: https://bugs.ruby-lang.org/issues/16806 [Bug #16889]: https://bugs.ruby-lang.org/issues/16889 [Bug #16908]: https://bugs.ruby-lang.org/issues/16908 @@ -217,4 +245,5 @@ The following deprecated APIs are removed. https://github.com/ruby/ruby/blob/trunk/NEWS.md#L245 [Feature #18571]: https://bugs.ruby-lang.org/issues/18571 [Feature #18585]: https://bugs.ruby-lang.org/issues/18585 [Feature #18598]: https://bugs.ruby-lang.org/issues/18598 +[Bug #18625]: https://bugs.ruby-lang.org/issues/18625 [Bug #18633]: https://bugs.ruby-lang.org/issues/18633 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/