lua-users home
lua-l archive

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


On Sun, 6 Oct 2019 at 18:46, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> This is now committed. So we can simply write:
>
> function x()
>    defer print('exited') end
> end
>
> Credit for this idea goes to Daurnimator:
> http://lua-users.org/lists/lua-l/2019-06/msg00280.html
>
> > 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
> >

One thing I realized while implementing this approach is that it
doesn't require folks to rewrite their libraries to implement __close
metamethods; i.e. user code can take advantage of deterministic
cleanup without having to use 5.4 only compatible libraries. In
particular, a patch can be applied to 5.3 to support this syntax.

Regards