From: "Eregon (Benoit Daloze)" Date: 2021-12-03T10:20:56+00:00 Subject: [ruby-core:106450] [Ruby master Feature#16456] Ruby 2.7 argument delegation (...) should be its own kind of parameter in Method#parameters Issue #16456 has been updated by Eregon (Benoit Daloze). Target version set to 3.1 Status changed from Open to Closed On current master: ```ruby irb(main):001:0> def foo(...); end irb(main):002:0> p method(:foo).parameters [[:rest, :*], [:keyrest, :**], [:block, :&]] ``` Which seems exactly the same semantics to what you'd get if you manually desugared to `def foo(*a, **kw, &b)`, except for the names. A new new kind would cause some incompatibilities and there doesn't seem to be a need. So I'll mark this as closed, since `parameters` now reflects what `(...)` forwards. ---------------------------------------- Feature #16456: Ruby 2.7 argument delegation (...) should be its own kind of parameter in Method#parameters https://bugs.ruby-lang.org/issues/16456#change-95105 * Author: aaronc81 (Aaron Christiansen) * Status: Closed * Priority: Normal * Target version: 3.1 ---------------------------------------- A method defined with `...` as its parameter list is equivalent to one defined with `*args, &blk`, according to `Method#parameters`. ```ruby def foo(...); end p method(:foo).parameters # => [[:rest, :*], [:block, :&]] ``` Even in Ruby 2.7, `...` and `*args, &blk` are not *quite* equivalent as the latter may produce a warning where the former does not. In Ruby 3.0 and beyond, `...` and `*args, &blk` will have a substantial semantic difference. Due to this, I don't consider the current behaviour of `Method#parameters` particularly ideal when dealing with methods using this new syntax. If the goal of `...` is to be a "delegate everything" operator, even when parameter passing is changed like in Ruby 3.0, I would propose that `Method#parameters` considers it a unique type of parameter. For example: ```ruby def foo(...); end p method(:foo).parameters # => [[:delegate, :"..."]] ``` -- https://bugs.ruby-lang.org/ Unsubscribe: