[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: state of the Lua nation on resource cleanup
- From: Matthew Wild <mwild1@...>
- Date: Wed, 21 Jan 2009 02:15:39 +0000
On Mon, Jan 19, 2009 at 11:37 PM, John Belmonte <firstname.lastname@example.org> wrote:
> Yes. 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 , highly error prone, and
> makes heavy use of protected calls-- limiting potential use of
In addition there is a certain overhead associated with pcall. Largely
in that it is in itself an additional function call, but it highlights
(perhaps the already obvious point) that whatever we might
replace/supplement it with must be quite competitive with regards to
speed and overhead.
This added to the points above is why in our project we don't throw
any errors ourselves, and what pcalls we have are placed to catch
those thrown by the standard library, or external user code.
This said, I don't want to change anything for the sake of it. If a
new solution is not a clear winner against pcall all round then I
suggest we shouldn''t change at all.