[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: Tue, 20 Jan 2009 20:48:01 -0500
On Tue, Jan 20, 2009 at 5:56 PM, Asko Kauppi <askok@dnainternet.net> wrote:
>
> Last time I checked, the Lua 'error' mechanism was plenty enough.
>
> In other words, what exactly does it _not_ cover, in your and/or David's
> opinion? Give us a list.
Asko, you know that I'm very familiar with Lua and its error
mechanism, so how should I interpret your response?
Repeated from the previous message for you:
Many applications expose scarce resources to the scripting
environment such as locks; handles for files, memory, and database
transactions; etc. Such resources need to be released promptly and
deterministically after use, and despite any exceptional condition in
the program. Of course this can be accomplished with Lua as it is,
but the resulting code is hard to follow [1], highly error prone, and
makes heavy use of protected calls-- limiting potential use of
coroutines.
[1] Challenge: implement Alex Mania's "appendud" example function
in plain Lua while keeping the code easy to follow. See
<http://lua-users.org/lists/lua-l/2008-02/msg00243.html>.