diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2019-08-31 07:03:27 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2019-08-31 07:03:27 +0900 |
commit | a1e588d1a73e3d72cd9ce6a2516ada9baeb77861 (patch) | |
tree | 6207702d5ddc08b667ae8990750a9e76a5c70aba | |
parent | 38e08db48e9d8cf34b2362df24afa97ba1e2ff4b (diff) | |
download | ruby-a1e588d1a73e3d72cd9ce6a2516ada9baeb77861.tar.gz |
NEWS: Hash-to-keywords automatic conversion is now warned
A follow up for 16c6984bb9..b5b3afadfa. [Feature #14183]
-rw-r--r-- | NEWS | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -19,6 +19,25 @@ sufficient information, see the ChangeLog file or Redmine * Method reference operator, <code>.:</code> 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. |