Issue #19134 has been updated by Eregon (Benoit Daloze).
shugo (Shugo Maeda) wrote in #note-14:
Speaking of implicity of blocks, `def f; g(&);
end` causes a syntax error, so it may be better to allow it, or disallow `def f(...);
g(&); end` in the future versions.
Since some time @ko1 worked on no implicit block if not a parameter of the method (with
the exception of `yield` in the body). I think that's a good property, so I think
it's good for `def f; g(&); end` to be a syntax error.
For `def f(...); g(&); end` "..." is "capture all arguments,
positional, keyword and block" so I think it's more natural there to be able to
access the block (although I can't think of when that would be useful, maybe `def
f(...); g(&); h(...) end` when `h` is known to ignore the block but that feels hacky,
better use `(*, **, &)` parameters then).
Anyway, I've fixed the behavior of `...` as
described in #note-9.
Thanks!
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100680
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.2
----------------------------------------
`*` and `&` are allowed in the body of a method with `...` argument forwarding, but
`**` is not allowed.
```
def foo(...)
bar(*) # OK
baz(&) # OK
quux(**) # NG
end
```
Is it intended behavior?
It seems that parse.y has code like `#ifdef RUBY3_KEYWORDS`, and if RUBY3_KEYWORDS, `**`
will also be supported.
--
https://bugs.ruby-lang.org/