-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal proposal spec #12
Conversation
Only having the |
I think having 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can change the return signature of Proxy.revocable.
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.
What about changing |
Oh... This is definitely reasonable. So the correct choice is: accept it on both |
This proposal is definitely aiming at |
spec updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've answered my objection. I'll wait for the others to review before merging, for now.
I still have a concern about directly referencing AbortController as the mass-revocation signal basis. |
Maybe we can follow tc39/proposal-cancellation#31 as our foundation. |
There's a conflict. Can you please update this PR to account for that? |
01764c2
to
c885cba
Compare
@ajvincent done |
<emu-clause id="sec-proxy.revocable" oldids="sec-proxy-revocation-functions"><span id="sec-proxy-revocation-functions"></span> | ||
<h1><span class="secnum">1.3</span> Proxy.revocable ( <var>target</var>, <var>handler</var>, <var>options</var> )</h1> | ||
<p>The <code>Proxy.revocable</code> function is used to create a revocable Proxy object. When <code>Proxy.revocable</code> is called with arguments <var>target</var>, <var>handler</var> and <var>options</var>, the following steps are taken:</p> | ||
<emu-alg><ol><li>Let <var>p</var> be ? <emu-xref aoid="ProxyCreate"><a href="https://tc39.es/ecma262/#sec-proxycreate">ProxyCreate</a></emu-xref>(<var>target</var>, <var>handler</var>).</li><li><ins>Let <var>signal</var> be ? <emu-xref aoid="GetProxySignal" id="_ref_0"><a href="#sec-get-proxy-signal">GetProxySignal</a></emu-xref>(<var>options</var>).</ins></li><li><ins>If <var>signal</var> is not <emu-val>undefined</emu-val>, then</ins><ol><li><ins>Let <var>p</var>.[[RevocationSignal]] be <var>signal</var>.[[HostRevocationSignal]].</ins></li></ol></li><li>Let <var>revokerClosure</var> be a new <emu-xref href="#sec-abstract-closure"><a href="https://tc39.es/ecma262/#sec-abstract-closure">Abstract Closure</a></emu-xref> with no parameters that captures nothing and performs the following steps when called:<ol><li>Let <var>F</var> be the <emu-xref href="#active-function-object"><a href="https://tc39.es/ecma262/#active-function-object">active function object</a></emu-xref>.</li><li>Let <var>p</var> be <var>F</var>.[[RevocableProxy]].</li><li>If <var>p</var> is <emu-val>null</emu-val>, return <emu-val>undefined</emu-val>.</li><li>Set <var>F</var>.[[RevocableProxy]] to <emu-val>null</emu-val>.</li><li><emu-xref href="#assert"><a href="https://tc39.es/ecma262/#assert">Assert</a></emu-xref>: <var>p</var> is a Proxy object.</li><li>Set <var>p</var>.[[ProxyTarget]] to <emu-val>null</emu-val>.</li><li>Set <var>p</var>.[[ProxyHandler]] to <emu-val>null</emu-val>.</li><li><ins>Set <var>p</var>.[[RevocationSignal]] to <emu-val>null</emu-val>.</ins></li><li>Return <emu-val>undefined</emu-val>.</li></ol></li><li>Let <var>revoker</var> be <emu-xref aoid="CreateBuiltinFunction"><a href="https://tc39.es/ecma262/#sec-createbuiltinfunction">CreateBuiltinFunction</a></emu-xref>(<var>revokerClosure</var>, 0, <emu-val>""</emu-val>, « [[RevocableProxy]] »).</li><li>Set <var>revoker</var>.[[RevocableProxy]] to <var>p</var>.</li><li>Let <var>result</var> be <emu-xref aoid="OrdinaryObjectCreate"><a href="https://tc39.es/ecma262/#sec-ordinaryobjectcreate">OrdinaryObjectCreate</a></emu-xref>(<emu-xref href="#sec-properties-of-the-object-prototype-object"><a href="https://tc39.es/ecma262/#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>).</li><li>Perform ! <emu-xref aoid="CreateDataPropertyOrThrow"><a href="https://tc39.es/ecma262/#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>result</var>, <emu-val>"proxy"</emu-val>, <var>p</var>).</li><li>Perform ! <emu-xref aoid="CreateDataPropertyOrThrow"><a href="https://tc39.es/ecma262/#sec-createdatapropertyorthrow">CreateDataPropertyOrThrow</a></emu-xref>(<var>result</var>, <emu-val>"revoke"</emu-val>, <var>revoker</var>).</li><li>Return <var>result</var>.</li></ol></emu-alg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if you updated the spec text so step 4h, which sets the [[RevocationSignal]]
to null despite step 3a.
I'll bet it's standard for the spec editing code to put all of this on one line, but it's really hard on the eyes to have to scroll so far in to fix a bug on one line.
I will merge with this bug in, and I ask you to write a follow-up PR to fix the bug.
Per #6, I'd also like a follow-up to modify new Proxy()
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see it's generated from spec.emu below. I didn't know that.
close #8