[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: pcall-like ability without closure - exposing setjmp/longjmp
- From: Thomas Harning <harningt@...>
- Date: Sun, 09 Dec 2007 20:19:07 -0500
Is there any danger in exposing setjmp/longjmp outside of the
pcall-mechanism in Lua?
I'm investigating creating a try-catch-like system without resorting to
closures... Preliminary idea would be something like:
if try() do
abort() -- jumps back to try setting something denoting error
Handle return value optionally rethrowing...
Haven't had much time to think of semantics, but I figured I'd make sure
that using stack manipulation like this wouldn't be fatal.
One potential case would be to implement RAII-type features for Lua.
Another item... would it be possible to make the 'pcall'/'error' system
work in this way... so that a normal error would be caught in the