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 <mobile@majumdar.org.uk> 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()
1
2
3
4
5
>

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'.

https://github.com/dibyendumajumdar/ravi/tree/defer

Regards