From a1e588d1a73e3d72cd9ce6a2516ada9baeb77861 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sat, 31 Aug 2019 07:03:27 +0900 Subject: NEWS: Hash-to-keywords automatic conversion is now warned A follow up for 16c6984bb9..b5b3afadfa. [Feature #14183] --- NEWS | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 0769f59297..1714f96df5 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,25 @@ sufficient information, see the ChangeLog file or Redmine * Method reference operator, .: is introduced as an experimental feature. [Feature #12125] [Feature #13581] +* Preparations for the redesign of keyword arguments towards Ruby 3. + [Feature #14183] + * Automatic conversion from a Hash to keyword arguments is deprecated: + when a method call passes a Hash at the last argument, and when the + called method accepts keywords, it is warned. + Please add a double splat operator. + + def foo(key: 42); end; foo({key: 42}) # warned + def foo(**kw); end; foo({key: 42}) # warned + def foo(key: 42); end; foo(**{key: 42}) # OK + def foo(opt={}); end; foo( key: 42 ) # OK + + * Non-symbol keys are allowed as a keyword argument. + + def foo(**kw); p kw; end; foo("str" => 1) #=> {"str"=>1} + +* Automatic conversion of keyword arguments and positional ones is warned. + [Feature #14183] + * Proc.new and proc with no block in a method called with a block is warned now. -- cgit v1.2.3