Project

General

Profile

Actions

Feature #21813

open

Add [: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`

Added by pabloh (Pablo Herrero) about 10 hours ago. Updated about 10 hours ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:124385]

Description

When accessing Method#parameters for a method using forwarding parameters, an unexpected behavior arises:

def foo(*, **, &)
  "puts(#{(method(__method__).parameters.dig(0,1))})" # Works fine
end


def foo(...)
  "puts(#{(method(__method__).parameters.dig(0,1))})" # Fails!
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.

Updated by pabloh (Pablo Herrero) about 10 hours ago Actions #1

  • Description updated (diff)

Updated by pabloh (Pablo Herrero) about 10 hours ago Actions #2

  • Description updated (diff)
Actions

Also available in: PDF Atom