[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua 5.3 and C++ exceptions
- From: Roberto Ierusalimschy <roberto@...>
- Date: Sun, 15 Mar 2015 12:02:02 -0300
> > I am not sure what you mean by "exception safe". If you mean throwing
> > your own exceptions anywehre inside Lua and catching them anywhere
> > else [...].
> Yes, that would have been ideal! Thanks for the definite
> clarification, even if not the answer we were hoping for. I'm also
> assuming that making Lua fully exception safe requires more than just
> a few small changes...
Yes. The design of Lua is all around the concept of "protected calls"
(and, by implication, of unprotected calls). Several pieces of code in
Lua assume that someone else (the protected call) will clear its mess
if an exception occurrs. To make Lua "exception safe" in that general
sense, you would have to correct all those places that do "unprotected
calls", which are many and hard to find.
(To be honest, I think the real difficulty is finding the correct places
to correct and then testing the result, as any non-corrected place is a
source of a hard-to-find bug. Maybe the size of the change is not that
big after all, I really have no idea.)