Hello,
given:
l=lambda{p local_variables;p a}
a=:whatever
l[]
I know that ‘a’ variable shoud not be visible for closure, but why
local_variables reports that it exists ? Is this behaviour intended ?
lopex
Hello,
given:
l=lambda{p local_variables;p a}
a=:whatever
l[]
I know that ‘a’ variable shoud not be visible for closure, but why
local_variables reports that it exists ? Is this behaviour intended ?
lopex
On Mar 3, 2006, at 4:48 PM, Marcin MielżyÅ?ski wrote:
lopex
l is closing over main, main has a local_variables method, that is
what is being called not the proc’s local_variables.
Marcin MielżyÅ?ski wrote:
Hello,
given:
l=lambda{p local_variables;p a}
a=:whatever
l[]I know that ‘a’ variable shoud not be visible for closure, but why
local_variables reports that it exists ? Is this behaviour intended ?
Well, #local_variables is a method call so it resolves
at call time (at which point a is included). You could
also #eval ‘a’ at that point
lopex
E
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs