Proxy objects and collection

2014-09-02 Thread Daurnimator
I'd like to submit a request for some sort of Proxy collection notification, so resources can be freed. This will greatly help with language interoperability. I'm the maintainer of lua.vm.js[1], which allows Lua code to run in the browser. I've managed to construct a simple and robust

Re: Proxy objects and collection

2014-09-02 Thread Brendan Eich
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.

Re: Proxy objects and collection

2014-09-02 Thread Brendan Eich
Daurnimator wrote: On 2 September 2014 14:41, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org 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

Re: Proxy objects and collection

2014-09-02 Thread David Bruant
Le 02/09/2014 20:07, Daurnimator a écrit : 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

Re: Proxy objects and collection

2014-09-02 Thread Brendan Eich
Daurnimator wrote: On 2 September 2014 15:19, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: 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. Would it? If the

Re: Proxy objects and collection

2014-09-02 Thread Daurnimator
On 2 September 2014 16:40, Brendan Eich bren...@mozilla.org wrote: Daurnimator wrote: If the object is freed before the trap, then the trap just gets some sort of object id. Then it can call out to the external resource manager: hey, resource id 123 isn't needed any more. Which could then free

Re: Proxy objects and collection

2014-09-02 Thread Brendan Eich
Daurnimator wrote: On 2 September 2014 16:40, Brendan Eich bren...@mozilla.org mailto:bren...@mozilla.org wrote: Daurnimator wrote: If the object is freed before the trap, then the trap just gets some sort of object id. Then it can call out to the external resource manager: hey, resource