[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: state of the Lua nation on resource cleanup
- From: John Belmonte <john@...>
- Date: Mon, 16 Feb 2009 09:32:08 -0500
Roberto wrote:
> On the other hand, it is not difficult to add a "with" to the language
> that works with exceptions. All we have to do is to use the upvalue
> system. This system already has all that needs to control when a
> variable goes out of scope.
Yes, we laymen have known this at least since the non-local return
discussion in 2005
(http://lua-users.org/lists/lua-l/2005-08/msg00373.html). I have
spent a bit of time trying to implement the "with" statement but my
skills with Lua internals are pretty poor. It seems a bit more is
involved than hooking into the upval mechanism-- I get lost around the
point where it's apparent that a separate finalization call stack is
needed.
In any case, to me the finalize/guard patch and the full
try-catch-finally implementations are sufficient evidence that these
things are possible. I decided to put my energy into defining
requirements and arguing the case for improved cleanup support rather
than writing yet another implementation.
--John