From: Robert Klemme Date: 2003-05-21T22:57:31+09:00 Subject: Re: An Object Going Out Of Scope "Mauricio Fern�ndez" schrieb im Newsbeitrag news:20030521095729.GA24238@student.ei.uni-stuttgart.de... > On Wed, May 21, 2003 at 05:56:34PM +0900, Robert Klemme wrote: > > > > > > It seems you overlooked the fact that it is not implementable in current > > > Ruby, for it needs Procs to be rebound :) > > > > I'm not sure, whether I understand you correctly. The solution below does > > work. Why then is it not possible without rebinding procs? > > I meant my method, which is used like this > > auto(:var1, :var2, :etc) do > .... > end > > ie. > > def auto(*vars, &block) > begin > block.rebind(binding).call # rebind not in Ruby!!! > ensure > vars.each { |x| eval "#{x}.cleanup if #{x}" } > end > end > > The idea is getting 'var = foo" inside the block to create the local in > the outer scope (binding). Ok, I see. I distantly thought of that but dropped it since one does not really need the identifiers. :-) > You had better forget about this stupid thing of mine, and stay with the > good, implementable thing :-) I'll obediently do that. :-)) Kind regards robert