lua-users home
lua-l archive

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




On 2018-02-19 02:09 AM, nobody wrote:
On 2018-02-19 04:03, ThePhD wrote:
Perhaps tangential to the discussion, but longjmp / setjmp has bitten
me a lot too. From not running C++ destructors to making cleanup code
get skipped and generally surprising behavior, if there's any
mechanism I'd avoid in any API -- even with plain C where destructors
and stack unwinding isn't a thing -- it's these.

IIRC, you can compile Lua as C++, in which case it won't use setjmp / longjmp but do The C++ Thing, and then all of that should Just Work.

(If you look at the top of `ldo.c`, all the ugly stuff is tucked away in a bunch of small macros and should be relatively easy to change, if an alternate exception mechanism is available.)

(@Soni: Have you tried messing with that or do you already know that this doesn't help with the Rust situation?)


Rust doesn't have a well-defined panic handling mechanism. And you'd still need to mark functions as #[unwind], which is an unstable (only available on nightly) attribute.

-- nobody


--
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.