Actions
Bug #21778
closedBinding#eval vs implicit parameters
Bug #21778:
Binding#eval vs implicit parameters
Description
This works:
proc { |x| binding.eval('x') }.call(1) #=> 1
This doesn't (neither with numbered parameters, nor with it):
proc { _1; binding.eval('_1') }.call(1) # undefined local variable or method '_1' for main (NameError)
...even though binding is "aware" of _1 existence with implicit_parameters.
I don't think it is a "huge" bug or even practical one. I just wanted to highlight that maybe Binding#eval lacks some context that it should have?..
Or maybe it is my misunderstanding of Binding#eval, I expected that any code that will work in the place of a binding literally, should work in eval as well.
Actions