lua-users home
lua-l archive

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


On Tue, May 31, 2016 at 6:47 PM, Jay Carlson <nop@nop.com> wrote:

> On 2016-05-31, at 9:12 AM, Viacheslav Usov <via.usov@gmail.com> wrote:
>
> Fundamentally, however, the flaw in the language is not its lack of a higher-level exception-handling abstraction, but its inability to finalize expensive resources deterministically. In C++, destructors do that, and, indeed, in C++ one can just get by with a single exception handler "that prints error messages". In Lua (today) this is not generally feasible.
>

How do "cleanup is stack-like" constructs interact with coroutines?

I am not convinced they should in any special way.

When a co-routine terminates, it basically means its highest level Lua block exits, at which point its locals will have been cleaned up. If a co-routine gets assigned to a non-local and then suspended indefinitely, then be it, the co-routine and its locals may be collected non-deterministically.

Cheers,
V.