From: Eric Sunshine Date: 2003-12-21T10:18:11+09:00 Subject: Re: Lexically scoped variables On Sun, 21 Dec 2003 10:06:36 +0900, Gregory Millam wrote: > if true > foo = BigObject.new > .. manipulate foo > end > puts foo # doesn't exist This is incorrect. In Ruby, the binding of 'foo' continues to exist after the 'if' statement. > def scope > yield if block_given? > end > -- > scope { > foo = BigObject.new > .. manipulate foo > } > puts foo # doesn't exist > Of course, if you do > foo = "" > scope { > foo = .. > } > p foo # What you assigned to it within scope. > Just don't initialize 'foo' outside of the scope. I'm not sure what you are trying to say here. This is simply a re-iteration of everything I said in my original email. -- ES