< :前の番号
^ :番号順リスト
> :次の番号
P :前の記事(スレッド移動)
N :次の記事(スレッド移動)
|<:前のスレッド
>|:次のスレッド
^ :返事先
_:自分への返事
>:同じ返事先を持つ記事(前)
<:同じ返事先を持つ記事(後)
---:分割してスレッド表示、再表示
| :分割して(縦)スレッド表示、再表示
~ :スレッドのフレーム消去
.:インデックス
..:インデックスのインデックス
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>