[前][次][番号順一覧][スレッド一覧]

ruby-changes:60342

From: Jeremy <ko1@a...>
Date: Tue, 10 Mar 2020 00:13:06 +0900 (JST)
Subject: [ruby-changes:60342] 9034cbd331 (master): Update NEWS for autosplatting change [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=9034cbd331

From 9034cbd331624089524a239a050c906bdd798482 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@j...>
Date: Mon, 9 Mar 2020 08:11:13 -0700
Subject: Update NEWS for autosplatting change [ci skip]


diff --git a/NEWS.md b/NEWS.md
index 611fb6a..f73b3fb 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -14,6 +14,21 @@ sufficient information, see the ChangeLog file or Redmine https://github.com/ruby/ruby/blob/trunk/NEWS.md#L14
   Code that resulted in deprecation warnings in Ruby 2.7 will now
   result in ArgumentError or different behavior. [[Feature #14183]]
 
+* Procs accepting a single rest argument and keywords are no longer
+  subject to autosplatting.  This now matches the behavior of Procs
+  accepting a single rest argument and no keywords.
+  [[Feature #16166]]
+
+    pr = proc{|*a, **kw| [a, kw]}
+
+    pr.call([1])
+    # 2.7 => [[1], {}]
+    # 3.0 => [[[1]], {}]
+
+    pr.call([1, {a: 1}])
+    # 2.7 => [[1], {:a=>1}] # and deprecation warning
+    # 3.0 => [[[1, {:a=>1}]], {}]
+
 * $SAFE is now a normal global variable with no special behavior.
   [[Feature #16131]]
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]