1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/doc/syntax
Jeremy Evans f53dfab95c Add support for anonymous rest and keyword rest argument forwarding
This allows for the following syntax:

```ruby
def foo(*)
  bar(*)
end
def baz(**)
  quux(**)
end
```

This is a natural addition after the introduction of anonymous
block forwarding.  Anonymous rest and keyword rest arguments were
already supported in method parameters, this just allows them to
be used as arguments to other methods.  The same advantages of
anonymous block forwarding apply to rest and keyword rest argument
forwarding.

This has some minor changes to #parameters output.  Now, instead
of `[:rest], [:keyrest]`, you get `[:rest, :*], [:keyrest, :**]`.
These were already used for `...` forwarding, so I think it makes
it more consistent to include them in other cases.  If we want to
use `[:rest], [:keyrest]` in both cases, that is also possible.

I don't think the previous behavior of `[:rest], [:keyrest]` in
the non-... case and `[:rest, :*], [:keyrest, :**]` in the ...
case makes sense, but if we did want that behavior, we'll have to
make more substantial changes, such as using a different ID in the
... forwarding case.

Implements [Feature #18351]
2021-12-30 14:37:42 -08:00
..
assignment.rdoc [DOC] DOT is not a part of a receiver [ci skip] 2019-09-20 16:43:39 +09:00
calling_methods.rdoc [DOC] Add documentation for hash value omission syntax 2021-12-20 01:09:52 +09:00
comments.rdoc Clarify docs about magic comments placement 2021-10-30 09:59:59 +09:00
control_expressions.rdoc Add pattern matching documentation 2020-02-24 00:28:13 +09:00
exceptions.rdoc Fix typos of previous docs PR 2019-12-23 08:36:58 +09:00
literals.rdoc [DOC] Add documentation for hash value omission syntax 2021-12-20 01:09:52 +09:00
methods.rdoc Add support for anonymous rest and keyword rest argument forwarding 2021-12-30 14:37:42 -08:00
miscellaneous.rdoc Document defined? and global_variables handling of regexp global variables [ci skip] 2020-03-06 13:06:49 -08:00
modules_and_classes.rdoc Update private visibility explanation 2019-12-22 23:17:39 +09:00
pattern_matching.rdoc Allow omission of parentheses in one line pattern matching [Feature #16182] 2021-08-19 17:07:58 +09:00
precedence.rdoc Document the difference between expressions and statements [ci skip] 2019-10-10 13:45:19 -07:00
refinements.rdoc Clarify behavior of super in method in module included in refinement [ci skip] 2020-07-10 15:31:51 -07:00