[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>
Issue #18888 has been reported by shugo (Shugo Maeda).
16 messages
2022/06/30
[ruby-core:108983] [Ruby master Bug#18837] Not possible to evaluate expression with numbered parameters in it
From:
"hurricup (Alexandr Evstigneev)" <noreply@...>
Date:
2022-06-17 12:48:12 UTC
List:
ruby-core #108983
Issue #18837 has been reported by hurricup (Alexandr Evstigneev).
----------------------------------------
Bug #18837: Not possible to evaluate expression with numbered parameters in it
https://bugs.ruby-lang.org/issues/18837
* Author: hurricup (Alexandr Evstigneev)
* Status: Open
* Priority: Normal
* Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN
----------------------------------------
I presume it's not really a bug, but design flaw, but this is really frustrating. Use case is - debugger.
Here is script with expected behavior:
```
def dumper(bnd)
puts bnd.local_variable_get 'i'
puts bnd.eval 'i * 10'
end
[1,2].each { |i| dumper(binding) }
```
And this one attempts to do the same with numbered params:
```
def dumper(bnd)
puts bnd.local_variable_get('_1')
puts bnd.eval '_1 * 10'
end
[1,2].each do
some = _1 # without this line even local_variable_get won't work, still it may be in any place of block
dumper(binding)
end
```
But `eval` wont ever work and this necessity for using `_1` so binding could see it may be confusing as well.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>