Open dead-claudia opened 11 months ago
I think this is unwise, for two reasons.
Sure, you could theoretically. Why would you want to?
@ajvincent I wasn't intending to make a suggestion here. I just wanted to give some visibility on an interesting result, in that the current Proxy.revocable
could be almost trivially written in terms of this proposal, and for similar reasons.
Sorry, should've made myself clearer.
Also, the full one with the extra signal parameter can just be done by using a proxy to a proxy, one for each signal:
Proxy.revocable = (target, handler, options) => {
const signal = Proxy.createSignal()
return {
proxy: new Proxy(new Proxy(target, handler, options), {}, {signal}),
revoke() {
Proxy.finalizeSymbol(signal)
},
}
}
The existing
Promise,revocable
could be near trivially implemented as follows in the current proposal, ignoring the part about the added symbol: