Closed Jack-Works closed 2 years ago
Only having the isRevoked
getter and not a way to listen for the revoke call seems like it would add a delay to when the target
and handler
references are dropped allowing them to be collected?
I think having Proxy.revocable()
not always return {proxy, revoke}
is something we can not ask for. Though it may seem weird, I can foresee someone out there wanting to still revoke an individual proxy, while letting hundreds of others live. Plus, it's a change in what the function actually returns from a generic dictionary to a Proxy.
So the algorithm at 1.3 step 3b has to go, and the "Else" branch at 1.4 has to be unconditionally run, I think.
Only having the
isRevoked
getter and not a way to listen for the revoke call seems like it would add a delay to when thetarget
andhandler
references are dropped allowing them to be collected?
Observation was dropped / deferred to another time, per #4. As for why, the brief explanation at the bottom of our README gives the rationale.
The current semantics allows the engine to GC all targets & handlers of the proxy.
I think having Proxy.revocable() not always return {proxy, revoke} is something we can not ask for.
What about changing Proxy.revocable
to return { proxy: T, revoke?: Function }
? I prefer adding this functionality to the Proxy.revocable
instead of new Proxy
because it has better semantics.
Though it may seem weird, I can foresee someone out there wanting to still revoke an individual proxy, while letting hundreds of others live.
Oh... This is definitely reasonable. So the correct choice is: accept it on both Proxy.revocable
and new Proxy
(as 3rd argument)
The current semantics allows the engine to GC all targets & handlers of the proxy.
I think having Proxy.revocable() not always return {proxy, revoke} is something we can not ask for.
What about changing
Proxy.revocable
to return{ proxy: T, revoke?: Function }
? I prefer adding this functionality to theProxy.revocable
instead ofnew Proxy
because it has better semantics.
This proposal is definitely aiming at Proxy.revocable
, and considering new Proxy
in #6.
spec updated.
I still have a concern about directly referencing AbortController as the mass-revocation signal basis.
Maybe we can follow https://github.com/tc39/proposal-cancellation/issues/31 as our foundation.
There's a conflict. Can you please update this PR to account for that?
@ajvincent done
close #8