[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: state of the Lua nation on resource cleanup
- From: David Manura <dm.lua@...>
- Date: Wed, 21 Jan 2009 01:00:19 -0500
On Tue, Jan 20, 2009 at 6:50 PM, Petite Abeille wrote:
> What's wrong with pcall?
> What about something along these lines.:
> Try( Function, ... )( Catch, Finalize )
Which is roughly one of the two solutions in Lua Programming Gems,
Chapter 13 (some other solutions in decision #5 can be implemented in
terms of pcall as well). Some arguments given against a pcall
implementation are that an unpatch pcall can interfere with coroutines
(which of course can be patched), returns and breaks inside the try
"block" don't have their usual block-level semantics (since the block
is really a function), pcall affects tracebacks a bit (e.g. you
instead need xpcall to forward the error handler, errorlevel isn't
preserved, etc.), and there may be some performance implications.
Still, it's do-able, and this could be an acceptable reason against
decision #1.