mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
NEWS: Hash-to-keywords automatic conversion is now warned
A follow up for 16c6984bb9..b5b3afadfa. [Feature #14183]
This commit is contained in:
parent
38e08db48e
commit
a1e588d1a7
1 changed files with 19 additions and 0 deletions
19
NEWS
19
NEWS
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue