[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: (not) handling new programming idioms with grace
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 16 Jul 2018 14:54:58 -0300
> I don't believe it is technically possible to implement deterministic
> cleanup of objects in Lua. I think the main issue is Lua's approach of
> throwing exceptions using longjmp. As far as I know, you need
> systematic stack unwinding in order to implement something like this -
> and that would be impossible to do while keeping Lua's primary design
> criteria - to be small and portable.
>
> If you have a technical solution that works - or if anyone else has -
> would be happy to be corrected.
We do. All this has been discussed some time ago; see [1].
(BTW, you brought the same issue to that thread, and you got the
answer there :-)
However, a main issue of any "deterministic cleanup" in Lua is its
interaction with coroutines. A coroutine can enter a block and never
leave it.
[1] http://lua-users.org/lists/lua-l/2015-11/msg00303.html
-- Roberto