From: ahoward Date: 2003-02-01T03:27:10+09:00 Subject: Re: Local variables & blocks On Sat, 1 Feb 2003, Yukihiro Matsumoto wrote: > The "defined?" status resolved at compile time, so that this never be > true, even after the first iteration, since there's no preceding > assignment to the variable "bar". to clarify (for my sake), vairables are _always_ resolved lexically and _never_ dynamically? eg. dynamic resolution ~/eg/ruby > cat foo.rb code = ARGV.shift p code eval code p (eval 'x') eg/ruby > ruby foo.rb 'x = 42' "x = 42" 42 lexical resolution eg/ruby > cat foo.rb code = ARGV.shift p code eval code p (x) eg/ruby > ruby foo.rb 'x = 42' "x = 42" foo.rb:4: undefined local variable or method `x' for # (NameError) -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================