Project

General

Profile

Feature #21813

Updated by pabloh (Pablo Herrero) 2 days ago

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))})" "puts(#{(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))})" "puts(#{(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. 

Back