From: Robert Klemme Date: 2003-12-26T19:56:51+09:00 Subject: Re: Lexically scoped variables "Eric Sunshine" schrieb im Newsbeitrag news:200312210059.AA01896@sunshineco.com... > On Sat, 20 Dec 2003 07:06:20 +0900, Gregory Millam wrote: > > Received: Sat, 20 Dec 2003 06:47:53 +0900 > > And lo Eric wrote: > > > scope { > > > foo = BigObject.new > > > ... manipulate foo ... > > > } > > Take an idea from File? > > BigObject.new do |foo| > > ... manipulate foo ... > > end > > 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. How about: Object.new.instance_eval do reclaimed = "foo" p reclaimed @reclaimed_too = "bar" p @reclaimed_too end # error p reclaimed # nil p @reclaimed_too robert