[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: An interesting new ways to do errors
- From: Daurnimator <quae@...>
- Date: Wed, 23 Nov 2011 00:19:34 +1100
On 22 November 2011 23:42, Tony Finch <dot@dotat.at> wrote:
> Daurnimator <quae@daurnimator.com> wrote:
>> - The standard lua error system is no longer needed: adding something
>> like this to the standard distribution may really simplify thing: “A
>> designer knows that he has achieved perfection not when there is
>> nothing left to add, but when there is nothing left to take away”
>
> The key thing about Lua's error handling is it maps exactly on to setjmp()
> and longjmp(). So your scheme would require setjmp to be called in
> resume(), and the coroutine state to be saved in a longjmp-proof
> way whenever a C function is called.
>
> Tony.
That already happens.
see: http://www.lua.org/source/5.1/ldo.c.html#lua_resume
and follow it to: http://www.lua.org/source/5.1/ldo.c.html#luaD_rawrunprotected
and end up at: http://www.lua.org/source/5.1/luaconf.h.html#LUAI_TRY
D