lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

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
(  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

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.