Issue #19134 has been updated by shugo (Shugo Maeda).
Status changed from Closed to Open
I think it's most conservative to probhibit `*` and `**`:
```
def foo(...)
bar(&) # OK
baz(*) # error
quux(**) # error
end
```
And a error should occur in the following code instead of dropping keyword arguments:
```
def foo(*, **, &)
bar(...)
end
def bar(*args, **kw, &block)
p [args, kw, block&.call]
end
foo(1, 2, x: 3, y: 4) { 5 }
```
What do you think, Matz?
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100495
* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19134 has been updated by shugo (Shugo Maeda).
Eregon (Benoit Daloze) wrote in #note-5:
> IMHO if `...` is used then `*`, `**` and `&` should all be forbidden (a SyntaxError at parse time).
> Because that way is the best for optimizing delegation.
> And also taking apart `*` and `**` is arguably not really delegation anymore.
`&` is allowed in 3.1, so it's a breaking change to prohibit it.
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100493
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19134 has been updated by Eregon (Benoit Daloze).
Although, it should still be possible to optimize delegation as good as possible and allow `*`/`**`/`&` by having those behave like `def args(*,**,&) = *`, `def kwargs(*,**,&) = **`, `def block(*,**,&) = &` and as if `*` was replaced by `args(...)`, etc, but that's of course at the expense of making the handling of those slightly slower and more complicated (but at least it doesn't slow down delegation via `(...)`).
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100489
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19134 has been updated by Eregon (Benoit Daloze).
IMHO if `...` is used then `*`, `**` and `&` should all be forbidden (a SyntaxError at parse time).
Because that way is the best for optimizing delegation.
And also taking apart `*` and `**` is arguably not really delegation anymore.
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100486
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19163 has been reported by matz (Yukihiro Matsumoto).
----------------------------------------
Feature #19163: Data object should be frozen
https://bugs.ruby-lang.org/issues/19163
* Author: matz (Yukihiro Matsumoto)
* Status: Open
* Priority: Normal
----------------------------------------
If we call `initialize` (via `send`), we can rewrite an existing Data object.
```ruby
d=Data.define(:a, :b).new(1,2)
p d #=> #<data a=1, b=2>
d.send(:initialize, {a:3,b:4})
p d #=> #<data a=3, b=4>
```
Should we freeze the Data object after calling `initialize` for the first time?
Matz.
--
https://bugs.ruby-lang.org/
Issue #19134 has been updated by shugo (Shugo Maeda).
matz (Yukihiro Matsumoto) wrote in #note-2:
> LGTM.
Thank you. I've merged it.
I realized that my fix also chaged the behavior of the following code:
```ruby
def foo(*, **, &)
bar(...)
end
def bar(*args, **kw, &block)
p [args, kw, block&.call]
end
foo(1, 2, x: 3, y: 4) { 5 }
```
My fix changed the result from `[[1, 2], {}, 5]` to `[[1, 2], {:x=>3, :y=>4}, 5]`.
So `...` is now a syntax sugar of `*, **, &`.
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100306
* Author: shugo (Shugo Maeda)
* Status: Closed
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19134 has been updated by matz (Yukihiro Matsumoto).
LGTM.
Matz.
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100293
* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/
Issue #19134 has been updated by shugo (Shugo Maeda).
I've created a pull request: https://github.com/ruby/ruby/pull/6818
With this change a test of rbs.gem fails because argument types of` def foo(...)` is changed to `(*untyped, **untyped **)` from `(*untyped)`, but I believe it's right.
(however, the specifal variable name `**` should be hidden by rbs.gem.)
I've created a issue: https://github.com/ruby/rbs/issues/1163
----------------------------------------
Feature #19134: ** is not allowed in def foo(...)
https://bugs.ruby-lang.org/issues/19134#change-100289
* Author: shugo (Shugo Maeda)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
`*` 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/