On Aug 13, 2011, at 2:17 AM, Agent Mulder wrote:

> Hello.
>=20
> When I call a function with an argument, I want to retrieve the NAME =
of
> the original argument I passed into the funtion. In the code snippet
> below, I want the last line of output to be:
>=20
> The NAME of the variable you passed in is: local_var
>=20
> instead of
>=20
> The NAME of the variable you passed in is: WHAT DO I NEED HERE?
>=20
> Thank you!
>=20
> <code>
>=20
> def a_not_so_special_function(a)
> puts "You are inside a_not_so_special_function().\n"
> puts "The VALUE of the variable you passed in is: "+a
> puts "The NAME of the variable you passed in is: "+"WHAT DO I NEED
> HERE?"
> end
>=20
> local_var=3D"foo"
> a_not_so_special_function(local_var)
>=20
> </code>

I suppose I'd have to ask why this is necessary. If you need a name =
associated with a value I'd recommend using a hash instead. Technically =
there might be a way be analyzing stack frames, but that would require =
access to the internals through the C API.

Regards,
Chris White
http://www.twitter.com/cwgem