From: matz@... (Yukihiro Matsumoto) Date: 2003-01-31T08:04:05+09:00 Subject: Re: Local variables & blocks Hi, In message "Re: Local variables & blocks" on 03/01/31, ahoward writes: |> But method-level scoping still works as before, so I don't see the problem. | |module M | | SOME_INIT_LIST.each do |item| | temp = M.method_a item | M.method_b temp | end | | # temp lives on in M's namespace !!!!!!! |end | |include M | |eval 'some code which may or may not set local var temp' | |if defined temp | # something very important, but will always run because module M writer | # screwed up!!!!!!!! |end Probably you misunderstood "block local variables" either the current one, or new one. "module" statement always introduce a new scope, and the scope is *not* the module's namespace. Local variables vanishes after the evaluation of the module body, unless they are captured by closures. As a consequence, "temp" does not survive after the "module" statement. matz.