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 `<main>'
        2: from foo.rb:2:in `block in <main>'
        1: from <internal:prelude>: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 `<main>'
	1: from -e:1:in `block in <main>'
-e:1:in `local_variable_get': wrong local variable name `@1' for #<Binding:0x00007f952401e490> (NameError)
~~~



-- 
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>