Proxy objects and collection

Brendan Eich brendan at
Tue Sep 2 12:19:49 PDT 2014

Daurnimator wrote:
> On 2 September 2014 14:41, Brendan Eich <brendan at 
> <mailto:brendan at>> wrote:
>     Daurnimator wrote:
>         So, I'd like to see some sort of "trap" that is fired when a
>         Proxy is collected.
>         To prevent over specifying how Javascript garbage collectors
>         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?

> I'm not sure if Javascript implementations already deal with this 
> elsewhere.

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 mailing list