I’m wondering – where /is/ the scope of local variables? Is there any
programmatic way to manipulate a local variable [by this, I rather
awkwardly mean – for example, is there a hash on some object of local
variables? Or something similar?] They seem special to me.
I know I can user defined? to test if they are defined, but is there any way
to get them throught metaprogramming?
No (except for eval). What do you want to acheive? Whatever it is,
there is probably another way, barring wanting to mess with local
variables for the sake of messing with local variables.
On 08.09.2007 15:15, Arlen Christian Mart C. wrote:
I’m wondering – where /is/ the scope of local variables? Is there any
programmatic way to manipulate a local variable [by this, I rather
awkwardly mean – for example, is there a hash on some object of local
variables? Or something similar?] They seem special to me.
There is a fairly easy way to manipulate them:
foo = 10
If your set of variables you need to manipulate is not fixed you better
use a Hash directly. There are some ways to manipulate “unknown” local
variables, but they typically involve using “eval”. You’ll find plenty
of discussions of this topic in the archives.