Proxy objects and collection
brendan at mozilla.org
Tue Sep 2 12:19:49 PDT 2014
> On 2 September 2014 14:41, Brendan Eich <brendan at mozilla.org
> <mailto:brendan at mozilla.org>> wrote:
> Daurnimator wrote:
> So, I'd like to see some sort of "trap" that is fired when a
> Proxy is collected.
> should operate,
> I propose that the trap *may* only be called at some
> *undefined* point after the object is not strongly referenced.
> What would you need in the way of an argument to be passed to the
> trap, at this later point?
> I'd imagine the proxy itself (which would be `this`).
> The trap would not need to return anything.
> There might be an argument here for some sort of object id instead of
> the proxy itself, to avoid resurrection?
Indeed we do not want post-mortem resurrection, but any id would have
the problem too, if it were strongly linked; and would have a similar
problem if weak.
In terms of LuaVM, can you say very concretely what you need? A handle
to the LuaVM peer of the proxy, the object the proxy reflects into JS?
GC is quite involved, and as you suggest, not to be exposed naively to
JS "user code".
Have you seen
which has evolved on es-discuss:
and probably other threads I'm forgetting.
More information about the es-discuss