From: "mame (Yusuke Endoh) via ruby-core" Date: 2025-12-14T02:39:32+00:00 Subject: [ruby-core:124188] [Ruby Bug#21778] Binding#eval vs implicit parameters Issue #21778 has been updated by mame (Yusuke Endoh). Status changed from Open to Rejected This was pointed by @ko1 at the dev meeting in the discussion of #21049, and we agreed not to implement it. Implementing it would require the parser to accept more detailed outer context, and that effort was not worth. Sorry it wasn't clearly written in the dev meeting log. ---------------------------------------- Bug #21778: Binding#eval vs implicit parameters https://bugs.ruby-lang.org/issues/21778#change-115662 * Author: zverok (Victor Shepelev) * Status: Rejected * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- This works: ```ruby proc { |x| binding.eval('x') }.call(1) #=> 1 ``` This doesn't (neither with numbered parameters, nor with `it`): ```ruby 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. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/