Project

General

Profile

Feature #15915

`@1` cannot get from meta-programming

Added by znz (Kazuhiro NISHIYAMA) about 1 month ago. Updated about 1 month ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:93064]

Description

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)

History

Updated by sawa (Tsuyoshi Sawada) about 1 month ago

What is the use case? And how do you want it to be made possible?

Updated by mame (Yusuke Endoh) about 1 month ago

What is the use case?

OP says a debugger. The motivation looks reasonable to me.

And how do you want it to be made possible?

I think it would be technically possible.

If this ticket is accepted, Binding#local_variables should include numbered parameters. It might be good to allow a symbol like :@1.

(I'm negative against numbered parameters themselves, though.)

Also available in: Atom PDF