From: hanachin@... Date: 2019-08-14T03:59:13+00:00 Subject: [ruby-core:94337] [Ruby master Feature#15915] `@1` cannot get from meta-programming Issue #15915 has been updated by hanachin (Seiei Miyagi). When I debug a proc which use the numbered parameters, I can not inspect the numbered parameters. Because irb use Binding to evaluate input but the numbered parameters can not get from binding. ```ruby square = -> { binding.irb @1 * @1 } square[rand(100)] ``` ``` % ruby foo.rb From: foo.rb @ line 2 : 1: square = -> { => 2: binding.irb 3: @1 * @1 4: } 5: square[rand(100)] irb(main):001:0> @1 Traceback (most recent call last): 3: from foo.rb:5:in `
' 2: from foo.rb:2:in `block in
' 1: from :206:in `irb' SyntaxError ((irb):1: numbered parameter outside block) ``` I need to give a name to the numbered parameters to inspect value. It doesn't make sense. ```ruby square = -> { v = @1 binding.irb @1 * @1 } square[rand(100)] ``` ---------------------------------------- Feature #15915: `@1` cannot get from meta-programming https://bugs.ruby-lang.org/issues/15915#change-80736 * Author: znz (Kazuhiro NISHIYAMA) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I think no way to get `@1` from meta-programming, so debugger is hard to inspect it. ~~~ % ruby -e 'proc{@1;binding.local_variable_get("@1")}.call(1)' Traceback (most recent call last): 2: from -e:1:in `
' 1: from -e:1:in `block in
' -e:1:in `local_variable_get': wrong local variable name `@1' for # (NameError) ~~~ -- https://bugs.ruby-lang.org/ Unsubscribe: