From: Zev Blut Date: 2005-06-02T12:17:04+09:00 Subject: Re: binding, ObjectSpace._id2ref [WAS] Re: [ANN] parseargs-0.0.0 Hello, On Thu, 02 Jun 2005 05:30:28 +0900, Ara.T.Howard wrote: > the problem here is that the variables will only be __available__ > through eval > either. eg. you'd have to > > p 'eval a' > > and could never > > p a > > i seem to recall a way of working around this but can't remember the > thread... > if i can figure it out i'll add this feature. Wow I am quite surprised at this! It is quite odd that adding a variable through the use of eval, makes the variable appear in the local_variables method, but that you cannot access the variable unless you use eval... Below is a simpler example showing how using eval modifies the the local_variables response. ---------------------------------------------------------------------- puts "[" + local_variables.join(" , ") + "]" #=> [] eval 'a = 42' puts "[" + local_variables.join(" , ") + "]" #=> [a] puts a #=> undefined local variable or method `a' for main:Object (NameError) ---------------------------------------------------------------------- If you cannot access a in your binding, why would eval add a to the local_variables? Can anyone explain this? I would like to know. Thanks, Zev Blut