Actions
Feature #21813
closedAdd [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
Feature #21813:
Add [:forward, :...] symbol tuple to indicate forwarding arguments when calling `Method#parameters`
Status:
Rejected
Assignee:
-
Target version:
-
Description
When accessing Method#parameters for a method using forwarding parameters, an unexpected behavior arises:
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.
Actions