From: Yukihiro Matsumoto Date: 2009-07-21T01:49:09+09:00 Subject: [ruby-core:24461] Re: lvar_propagate Hi, In message "Re: [ruby-core:24435] Re: lvar_propagate" on Sun, 19 Jul 2009 05:27:31 +0900, Laurent Sansonetti writes: |I am a bit confused. What would the following snippets do if lvar |propagation is implemented? | |# Snippet1 |0.times { x = 42 } # never called |x # nil or NameError? Scope propagation happens in compile time, so calling (or not) do not affect the scope, so x will be nil. |# Snippet2 |def foo | proc { x = 42 } # created but called later |end |def bar | foo.call | x # 42 or NameError? |end |bar Propagation will not happen across normal local variable scope (i.e. def/class/module), so x in bar has no chance to be declared as a local variable, thus NameError. matz.