From: David Alan Black Date: 2004-04-15T19:39:26+09:00 Subject: Re: New Local Variable Scope rule Hi -- ts writes: > >>>>> "D" == David Alan Black writes: > > D> def call_foo > D> a = lambda {|b| c = b} > D> puts c # error > D> end > > You want to say that this will give an error > > def foo(x) > end > > def call_foo > foo(lambda {|b| c = b}) > puts c # error > end > > and this not ? > > def foo(x) > x.call(24) > end > > def call_foo > foo(lambda {|b| c = b}) > puts c # 24 > end Yes, that's my interpretation. The other possibility, I think, is that c would be nil in the first example, similar to the familiar case of: if false; a = 1; end p a # nil That may be what will happen: l = lambda { a = 1 } p a # nil (not error) though I find that also to be strange behavior for a closure. (Of course, I'm one of the few who think the way block variables work pre-2.0 is fine, but that's another story :-) David -- David A. Black dblack@wobblini.net