Proxy objects and collection
brendan at mozilla.org
Tue Sep 2 13:40:15 PDT 2014
> On 2 September 2014 15:19, Brendan Eich <brendan at mozilla.org
> <mailto:brendan at 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 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 it.
That's cool, but what if the id died on the Lua side? You'd have to
avoid recycling it as another object. That makes it very much like a
> The discussions around security issues are somewhat interesting,
> though I think allayed by my proposal of an undefined interval (i.e.
> possibly delayed, or random)
> between the reference being dropped, and the finaliser getting called.
The trouble comes when one implementation is first or has the most
market power. Then developers (intentionally or not, doesn't matter)
come to depend on its implementation-defined interval.
The next-event-loop-turn thinking I remember from the weak refs threads
may be ok. I don't think there's a fast path for proxies, though. Weak
refs are wanted in ES7 or whatever annual edition after it that they fit in.
More information about the es-discuss