lua-users home
lua-l archive

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

On Sat, 5 Oct 2019 at 21:00, Dibyendu Majumdar <> wrote:

> I have a very early commit - based on Roberto's initial work on
> toclose vars, in my git repository (link below). The implementation is
> not complete and not working correctly yet.

Since luaF_close() call can now lead to stack being resized, it is
necessary to protect such calls; i.e. the base pointer must be
refreshed. I had missed that in my first commit.

Have only tested with simple examples so far. Here is an example session:

> function x()
>>    for i=1,5 do
>>        defer function() print(i) end
>>    end
>> end
> x()

BTW syntax of defer could be simplified by omitting the 'function()'.

The JIT backends are not yet fully updated.

Anyway, if anyone wants to try out, the branch is 'defer'.