lua-users home
lua-l archive

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

On Mon, Jan 19, 2009 at 11:37 PM, John Belmonte <> 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 [1], highly error prone, and
> makes heavy use of protected calls-- limiting potential use of
> coroutines.

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.