Proxy objects and collection

David Bruant bruant.d at gmail.com
Tue Sep 2 13:24:51 PDT 2014


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 strongly referenced.
As Brendan said, what you want has been discussed as Weak References on 
the list, not really proxies.

The question of not wanting to over-specify upfront has come in other 
places in the past. Sometimes, even when the spec leaves freedom to 
implementors, it happens that implemetors make some common choices, then 
people rely on the shared browser behavior of that spec-undefined 
functionality. Then, the feature has to be standardized de facto as 
commonly implemented afterwards.

My point here being that not specifying up front does not guarantee that 
the details won't have to be ever specified.
The enumeration order of object keys comes to mind.

I'm not saying that it's what will or even may happen in this case, but 
just remind that leaving things undefined can fire back and generate the 
opposite of what was intended.

David


More information about the es-discuss mailing list