Hi -- ts <decoux / moulon.inra.fr> writes: > >>>>> "D" == David Alan Black <dblack / wobblini.net> writes: > > D> def call_foo > D> foo(lambda{|b| c=b}) > > D> puts c # does c persist if the lambda was called? > D> end > > What you have written is similar to > > def call_foo > a = lambda {|b| c = b} > foo(a) > puts c > end > > foo(a) don't change anything and if I've well understood : this is at > compile time that ruby will make the decision (local/block-local) I'm really answering two of your posts, sort of -- this one, and the one where you give the 1.8 example with c=nil. I think foo(a) does change something, in the 2.0 model. If you don't have foo(a), then puts c will raise an error: def call_foo a = lambda {|b| c = b} puts c # error end This is therefore not the same as doing this in 1.8: def call_foo c = nil a = lambda {|b| c = b} puts c # OK, even if lambda never executes end David -- David A. Black dblack / wobblini.net