lua-users home
lua-l archive

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

On Sat, Nov 21, 2009 at 1:19 PM, Florian Weimer <> wrote:
>> Is there any tangible notion of what is to become of newproxy() ?
> __gc is called asynchronously at rather unpredictable points in the
> program.  A C extension writer can take that into account (and can
> actually do some useful work without invoking the garbage collector),
> but it's more difficult to do this in Lua code.

Having also found newproxy() useful for finalization of Lua objects, I
wonder why this is such a show-stopper. We all know that __gc happens
in its own sweet time. But for Lua objects, __gc is an opportunity to
ensure that some resource is released, eventually.

Is the issue that a __gc implemented in Lua can happen outside normal
program flow and mess with the state, hence the need for a queue?

A related question: what is the status of 'deterministic
finalization'?  I'm thinking of something akin to C#'s 'using'
statement. There is an opportunity with to implement
block-exit hooks.  If it could be done with little overhead, this
could be most useful, and would not happen asynchonously.

steve d.