lua-users home
lua-l archive

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


> 
> 
> > On 30 May 2019, at 02:38, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> > 
> > Lua 5.4.0 (alpha-rc1) is now available for testing at
> > 	http://www.lua.org/work/lua-5.4.0-alpha-rc1.tar.gz
> 
> >From the what I read about “to-be-closed” [1], the difference with an “__gc” method is that is doesn’t wait for the GC cycle to kick in, but it is invoked immediately when the variable goes out-of-scope. So it has deterministic timing over “__gc”.
> 
> If this is the case (please correct me if I’m wrong). Then why isn’t it just a flag on a meta-table? The meta table must be there already (since a requirement is to have an __gc method). One could even consider extending “__mode” to carry an extra character; "__mode = ‘kvc’ “.

What goes out of scope are variables, not values. What get metatables
are values, not variables.

-- Roberto