Received: Sun, 21 Dec 2003 09:59:56 +0900
And lo Eric wrote:

> Thanks, but this proposal is very special-case, whereas I'm looking for a  
> general purpose solution for automatic clean-up of variables in a  
> long-running interactive environment, much like my scope{} solution provides,  
> or { and } blocks in C.  In my example, BigObject was used merely to  
> illustrate that the user might be working with memory hungry objects in  
> various ways.

--
if true
 foo = BigObject.new
 .. manipulate foo
end
puts foo # doesn't exist
--
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.