* [ruby-core:124385] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
@ 2025-12-30 0:22 pabloh (Pablo Herrero) via ruby-core
2026-01-13 6:09 ` [ruby-core:124499] " nobu (Nobuyoshi Nakada) via ruby-core
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: pabloh (Pablo Herrero) via ruby-core @ 2025-12-30 0:22 UTC (permalink / raw)
To: ruby-core; +Cc: pabloh (Pablo Herrero)
Issue #21813 has been reported by pabloh (Pablo Herrero).
----------------------------------------
Feature #21813: Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
https://bugs.ruby-lang.org/issues/21813
* Author: pabloh (Pablo Herrero)
* Status: Open
----------------------------------------
When accessing `Method#parameters` for a method using forwarding parameters, an unexpected behavior arises:
```
def foo(*, **, &)
"puts(#{(method(__method__).parameters.dig(0,1))})" # Fails!
end
def foo(...)
"puts(#{(method(__method__).parameters.dig(0,1))})" # Works fine
end
```
It's very strange that you can't access the parameters, on `eval`, using the symbols provided at `Method#parameters`.
Adding `[:forward, :...]` or `[:forwarding, :...]` for those cases feels simply natural.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:124499] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
2025-12-30 0:22 [ruby-core:124385] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters` pabloh (Pablo Herrero) via ruby-core
@ 2026-01-13 6:09 ` nobu (Nobuyoshi Nakada) via ruby-core
2026-01-14 6:09 ` [ruby-core:124524] " pabloh (Pablo Herrero) via ruby-core
2026-02-12 8:09 ` [ruby-core:124784] " matz (Yukihiro Matsumoto) via ruby-core
2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2026-01-13 6:09 UTC (permalink / raw)
To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)
Issue #21813 has been updated by nobu (Nobuyoshi Nakada).
`foo(a: 1)` doesn't print what you expect, I guess.
----------------------------------------
Feature #21813: Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
https://bugs.ruby-lang.org/issues/21813#change-116057
* Author: pabloh (Pablo Herrero)
* Status: Open
----------------------------------------
When accessing `Method#parameters` for a method using forwarding parameters, an unexpected behavior arises:
```ruby
def foo(*, **, &)
binding.eval "print(#{(method(__method__).parameters.dig(0,1))})" # Works fine
end
foo(1,2,3,4) # => 1234
def bar(...)
binding.eval "print(#{(method(__method__).parameters.dig(0,1))})" # Fails!
end
bar(1,2,3,3) # SyntaxError
```
It's very strange that you can't access the parameters, on `eval`, using the symbols provided at `Method#parameters`.
Adding `[:forward, :...]` or `[:forwarding, :...]` for those cases feels simply natural.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:124524] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
2025-12-30 0:22 [ruby-core:124385] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters` pabloh (Pablo Herrero) via ruby-core
2026-01-13 6:09 ` [ruby-core:124499] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2026-01-14 6:09 ` pabloh (Pablo Herrero) via ruby-core
2026-02-12 8:09 ` [ruby-core:124784] " matz (Yukihiro Matsumoto) via ruby-core
2 siblings, 0 replies; 4+ messages in thread
From: pabloh (Pablo Herrero) via ruby-core @ 2026-01-14 6:09 UTC (permalink / raw)
To: ruby-core; +Cc: pabloh (Pablo Herrero)
Issue #21813 has been updated by pabloh (Pablo Herrero).
@nobu Perhaps I came up with a contrived example, but I wanted to point out that there is a lack of symmetry when it comes to `....`. As of right now, there is no way to know from the `Method` class API alone whether a method is using argument forwarding. You’d have to use Method#source_location and then parse the source file somehow.
----------------------------------------
Feature #21813: Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
https://bugs.ruby-lang.org/issues/21813#change-116085
* Author: pabloh (Pablo Herrero)
* Status: Open
----------------------------------------
When accessing `Method#parameters` for a method using forwarding parameters, an unexpected behavior arises:
```ruby
def foo(*, **, &)
binding.eval "print(#{(method(__method__).parameters.dig(0,1))})" # Works fine
end
foo(1,2,3,4) # => 1234
def bar(...)
binding.eval "print(#{(method(__method__).parameters.dig(0,1))})" # Fails!
end
bar(1,2,3,3) # SyntaxError
```
It's very strange that you can't access the parameters, on `eval`, using the symbols provided at `Method#parameters`.
Adding `[:forward, :...]` or `[:forwarding, :...]` for those cases feels simply natural.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:124784] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
2025-12-30 0:22 [ruby-core:124385] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters` pabloh (Pablo Herrero) via ruby-core
2026-01-13 6:09 ` [ruby-core:124499] " nobu (Nobuyoshi Nakada) via ruby-core
2026-01-14 6:09 ` [ruby-core:124524] " pabloh (Pablo Herrero) via ruby-core
@ 2026-02-12 8:09 ` matz (Yukihiro Matsumoto) via ruby-core
2 siblings, 0 replies; 4+ messages in thread
From: matz (Yukihiro Matsumoto) via ruby-core @ 2026-02-12 8:09 UTC (permalink / raw)
To: ruby-core; +Cc: matz (Yukihiro Matsumoto)
Issue #21813 has been updated by matz (Yukihiro Matsumoto).
Status changed from Open to Rejected
I failed to persuade me. I admit there's a lack of symmetry, but I don't think it's not worth the potential performance burden.
Matz.
----------------------------------------
Feature #21813: Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
https://bugs.ruby-lang.org/issues/21813#change-116395
* Author: pabloh (Pablo Herrero)
* Status: Rejected
----------------------------------------
When accessing `Method#parameters` for a method using forwarding parameters, an unexpected behavior arises:
```ruby
def foo(*, **, &)
args = method(__method__).parameters.map(&:last).join(',')
binding.eval "print(#{args})" # Works fine
end
foo(1,2,3,4, a: 23) # => 1234{a: 23}
def bar(...)
args = method(__method__).parameters.map(&:last).join(',')
binding.eval "print(#{args})" # Fails!
end
bar(1,2,3,3, a: 23) # SyntaxError
```
It's very strange that you can't access the parameters, on `eval`, using the symbols provided at `Method#parameters`.
Adding `[:forward, :...]` or `[:forwarding, :...]` for those cases feels simply natural.
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-12 8:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-30 0:22 [ruby-core:124385] [Ruby Feature#21813] Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters` pabloh (Pablo Herrero) via ruby-core
2026-01-13 6:09 ` [ruby-core:124499] " nobu (Nobuyoshi Nakada) via ruby-core
2026-01-14 6:09 ` [ruby-core:124524] " pabloh (Pablo Herrero) via ruby-core
2026-02-12 8:09 ` [ruby-core:124784] " matz (Yukihiro Matsumoto) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).