Daurnimator wrote:
On 2 September 2014 14:41, Brendan Eich <[email protected] <mailto:[email protected]>> 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

http://wiki.ecmascript.org/doku.php?id=strawman:weak_references

which has evolved on es-discuss:

http://esdiscuss.org/topic/what-is-the-status-of-weak-references
http://esdiscuss.org/topic/es6-es7-es8-and-beyond-a-proposed-roadmap

and probably other threads I'm forgetting.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to