Actions
Bug #18558
closedNumbered arguments + eval
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) [arm64-darwin20]
Description
def yield_2_args
yield 1, 2
end
yield_2_args { p [eval("_1"), _2] }
Running with ruby 2.7.2, I get output:
[1, 2]
[1, 2]
With 3.0.2, I get output:
[1, 2]
(eval):1:in `block in <main>': undefined local variable or method `_1' for main:Object (NameError)
from bug.rb:6:in `eval'
from bug.rb:6:in `block in <main>'
from bug.rb:2:in `yield_2_args'
from bug.rb:6:in `<main>'
Is is intentional change between 2.7.x and 3.0.x?
Updated by nobu (Nobuyoshi Nakada) almost 3 years ago
- Related to Feature #16432: Using `_1` inside `binding.irb` will cause unintended behavior added
Updated by nobu (Nobuyoshi Nakada) almost 3 years ago
- Status changed from Open to Closed
Yes, see [Feature #16432].
Actions
Like0
Like0Like0