Normative: Add using and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack - #3000
Conversation
b7b82d5 to
17e0bc0
Compare
|
I'm not quite sure how to address the remaining esmeta issues. |
|
Rather than suggest changes here, I've made a PR against this PR's branch: rbuckton#2 |
|
This last commit adds a few UpdateEmpty calls that aren't strictly necessary, but |
|
@rbuckton Sorry about that - esmeta is still a little imprecise. You should feel free to write the spec text you want and not worry about esmeta's errors, and we can update esmeta or the ignore file. |
I replaced the |
|
Please note, I've created rbuckton#3 as a separate PR against this one containing the additional specification changes that would be necessary to support https://github.com/tc39/proposal-async-explicit-resource-management, should it advance to Stage 3. |
|
I found an issue with the change in e4f2d05 to use an EE to restrict binding patterns, in that it results in an ambiguous parse of I've filed tc39/proposal-explicit-resource-management#152 against the proposal spec, and will update this PR in due time. |
tc39/proposal-explicit-resource-management#152 has merged, and I've amended this PR to match as part of 3044fd9. |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
This now includes the |
|
Note to implementers: There is a typo in |
|
This is also missing the consensus change to use |
|
This needs to be rebased before it can be merged, and it's not a trivial one. |
c06512e to
f2e685b
Compare
|
Squashed and rebased to simplify history and make things easier. |
f2e685b to
1ae839f
Compare
|
[https://res.public.onecdn.static.microsoft/files/fabric-cdn-prod_20251010.003/assets/item-types/16/pdf.svg]Revisión de 2004tc12-011-1 by Edgar Manuel Ruiz Ariasacepto términos y condiciones.pdf<https://1drv.ms/b/c/3b6ca5bfcad4519d/IQCCASFSS1HRTq6dTXHQzJS8AaftLfTs7mhQPMvT74JJBUg>+ > by Edgarruiz8585 Edgar Manuel Ruiz Arias https://github.com/Edgarruiz8585
Obtener Outlook para Android<https://aka.ms/AAb9ysg>
________________________________
From: jmdyck ***@***.***>
Sent: Tuesday, 16 June 2026 08:30:11
To: tc39/ecma262 ***@***.***>
Cc: Edgar Manuel Ruiz Arias ***@***.***>; Comment ***@***.***>
Subject: Re: [tc39/ecma262] Add `using` and `await using` Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack (PR #3000)
@jmdyck requested changes on this pull request.
Just some rebase-related updates.
________________________________
In spec.html<#3000 (comment)>:
@@ -1370,6 +1370,17 @@ <h1>Well-Known Symbols</h1>
</th>
</tr>
</thead>
+ <tr>
+ <td>
+ <dfn>%Symbol.asyncDispose%</dfn>
+ </td>
+ <td>
+ `"Symbol.asyncDispose"`
⬇️ Suggested change
- `"Symbol.asyncDispose"`
+ *"Symbol.asyncDispose"*
And similarly for Symbol.dispose, AsyncDisposableStack, DisposableStack, SuppressedError.
(See PR #3881<#3881>.)
________________________________
In spec.html<#3000 (comment)>:
@@ -3456,6 +3478,17 @@ <h1>Well-Known Intrinsic Objects</h1>
The prototype of Array Iterator objects (<emu-xref href="#sec-array-iterator-objects"></emu-xref>)
</td>
</tr>
+ <tr>
+ <td>
+ %AsyncDisposableStack%
+ </td>
+ <td>
+ `AsyncDisposableStack`
+ </td>
+ <td>
+ The AsyncDisposableStack constructor (<emu-xref href="#sec-asyncdisposablestack-constructor"></emu-xref>)
⬇️ Suggested change
- The AsyncDisposableStack constructor (<emu-xref href="#sec-asyncdisposablestack-constructor"></emu-xref>)
+ The `AsyncDisposableStack` <emu-not-ref>constructor</emu-not-ref> (<emu-xref href="#sec-asyncdisposablestack-constructor"></emu-xref>)
And similarly for DisposableStack, SuppressedError.
________________________________
In spec.html<#3000 (comment)>:
+ </emu-clause>
+
+ <emu-clause id="sec-disposablestack-objects">
+ <h1>DisposableStack Objects</h1>
+ <p>A DisposableStack is an object that can be used to contain one or more resources that should be disposed together.</p>
+ <p>Any DisposableStack object is in one of two mutually exclusive states: <em>disposed</em> or <em>pending</em>. A disposable stack `d` is pending if and only if neither `d.dispose()` nor `d.move()` has been invoked for `d`.</p>
+
+ <emu-clause id="sec-disposablestack-constructor">
+ <h1>The DisposableStack Constructor</h1>
+ <p>The DisposableStack constructor:</p>
+ <ul>
+ <li>is <dfn>%DisposableStack%</dfn>.</li>
+ <li>is the initial value of the *"DisposableStack"* property of the global object.</li>
+ <li>creates and initializes a new DisposableStack when called as a constructor.</li>
+ <li>is not intended to be called as a function and will throw an exception when called in that manner.</li>
+ <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified DisposableStack behaviour must include a `super` call to the DisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the `DisposableStack.prototype` built-in methods.</li>
⬇️ Suggested change
- <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified DisposableStack behaviour must include a `super` call to the DisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the `DisposableStack.prototype` built-in methods.</li>
+ <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified DisposableStack behaviour must include a `super` call to the DisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the built-in methods of `DisposableStack.prototype`.</li>
(See PR #3872<#3872>.)
________________________________
In spec.html<#3000 (comment)>:
+ </emu-clause>
+
+ <emu-clause id="sec-asyncdisposablestack-objects">
+ <h1>AsyncDisposableStack Objects</h1>
+ <p>An AsyncDisposableStack is an object that can be used to contain one or more resources that should be asynchronously disposed together.</p>
+ <p>Any AsyncDisposableStack object is in one of two mutually exclusive states: <em>disposed</em> or <em>pending</em>. An async-disposable stack `d` is pending if and only if neither `d.disposeAsync()` nor `d.move()` has been invoked for `d`.</p>
+
+ <emu-clause id="sec-asyncdisposablestack-constructor">
+ <h1>The AsyncDisposableStack Constructor</h1>
+ <p>The AsyncDisposableStack constructor:</p>
+ <ul>
+ <li>is <dfn>%AsyncDisposableStack%</dfn>.</li>
+ <li>is the initial value of the *"AsyncDisposableStack"* property of the global object.</li>
+ <li>creates and initializes a new AsyncDisposableStack when called as a constructor.</li>
+ <li>is not intended to be called as a function and will throw an exception when called in that manner.</li>
+ <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified AsyncDisposableStack behaviour must include a `super` call to the AsyncDisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the `AsyncDisposableStack.prototype` built-in methods.</li>
⬇️ Suggested change
- <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified AsyncDisposableStack behaviour must include a `super` call to the AsyncDisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the `AsyncDisposableStack.prototype` built-in methods.</li>
+ <li>may be used as the value in an `extends` clause of a class definition. Subclass constructors that intend to inherit the specified AsyncDisposableStack behaviour must include a `super` call to the AsyncDisposableStack constructor to create and initialize the subclass instance with the internal state necessary to support the built-in methods of `AsyncDisposableStack.prototype`.</li>
—
Reply to this email directly, view it on GitHub<#3000?email_source=notifications&email_token=CCSR3MJNNMEWHRZULTFVO435AFKXHA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTINJQG4ZTGOBRGYZKM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#pullrequestreview-4507338162>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/CCSR3MOLORFJX5PQA5CKIHT5AFKXHAVCNFSNUABEKJSXA33TNF2G64TZHMYTQNRQHE2DENZ3JFZXG5LFHMYTKNJTHE2DSMJRG2QXMAQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Updated. Can you take another look? |
|
Looks like that resolves all my nits. |
bcb9acd to
d7e588c
Compare
Mind approving then? It shows you as having open requested changes. |
…r, DisposableStack, and AsyncDisposableStack (tc39#3000) * Spec text for proposal-explicit-resource-management * Fix lint errors * Run formatter * Fix signature for DisposeResources * Fixes for some esmeta warnings * Fixes for some esmeta warnings * Add missing ReturnIfAbrupt in DisposableStack.prototype.use * More ecmarkup signature fixes * Change DisposeResources signature to return completion record * Order sections by property name * Syntax of types * id of AO clause doesn't need to include param names * Avoid the use of `Type()` * Use preamble conventions from PR tc39#2592 * Interface names are put in `<i>` rather than `<em>` * A 'Slots' table should have a 'Type' column * Add 'UsingDeclaration' to Annex A * misc minor fixes * add description suggestion from @jmdyck * Add DisposeCapabilityRecord from tc39/proposal-explicit-resource-management#144 * Wrap UpdateEmpty calls in calls to Completion * Run formatter * Run formatter again * Fix formatting and capitalization * Clean up DisposeResources signature, replace UpdateEmpty with assertions * Add 'either' in front of 'null or undefined' * Use CreateBuiltinFunction * Address additional editor feedback (from async PR) * Move BindingPattern restriction for 'using' to an early error * Fix typo in using declaration early errors * Fix typos * run formatter * Remove InstallErrorCause from SuppressedError, per 2023-jan consensus * Spec text for proposal-async-explicit-resource-management * Run formatter * Add 'either' in front of 'null or undefined' * Address editor feedback * Address additional editor feedback * Switch back to a production parameter, update ASI note * Remove 'await' restriction per March 2023 consensus. See tc39/proposal-explicit-resource-management#153 * Adopt consensus changes from tc39/proposal-explicit-resource-management#178 * Adopt consensus changes from tc39/proposal-explicit-resource-management#180 * Adopt typo fix from tc39/proposal-explicit-resource-management#217 * Fix typos and add temporary PR note * Remove temporary PR note * Remaining consensus updates from proposal repo * Add missing undefined check in GetDisposeMethod * Fix DisposeCapability leak * fix formatting * Switch to empty list * Update text of NOTE * Add PromiseCapability wrapper around sync dispose in an `await using` * Fix missing lookahead restriction * Remove superfluous ClassBody restriction * Add entries to esmeta-ignore * Reduce unnecessary Awaits for nullish values in blocks containing `await using` * Add missing 'constructor' definitions * Disallow using/await using in a switch case/default clause * Fix formatting * PR feedback * minor fixes * Switch from @@ to % in a few more places * Update esmeta-ignore.json * Update asyncDispose to be an async method * avoid threading kind through all the InitializeBinding machinery * rename _kind_ to _declarationKind_ in ForIn/OfBodyEvaluation since there's already _iterationKind_ and _lhsKind_ * move _declarationKind_ into the branch where that makes sense otherwise we're calling IsUsingDeclaration/IsAwaitUsingDeclaration on potentially an assignment target or var declaration, which they aren't defined over. * move it back * PR Feedback * Some missing changes pulled from #11 * Fix some remaining suggestions from #7 * Switch to `<em>` where appropriate * PR feedback * Don't overwrite completion parameter in DisposeResources * The spec usually uses lower-case for ids. * Drop 'variants' attribute * Changes to Annex A to make it parallel to main-body grammar * Add subclauses to "Constructor Properties of The Global Object" * Need to define ForDeclarationBindingInitialization for ForDeclaration * Remove unreachable SDO rules * Remove more unreachable SDO rules * Remove unnecessary steps in CreateDisposableResource * Add explicit return to algorithm * EvaluateClassStaticBlockBody: add an Assert * Remove 'kind' description from InitializeBinding * CaseBlock can't have resources, so just assert * Restore missing NOTE and fix indentation * ContainsUsing and HasUnterminatedUsingDeclaration are identical * Rename V to value and O to obj * Use list shorthand for NewDisposeCapability * Rely on NOTE rather than overwriting [[DisposableResourceStack]] * Add type to clauses and use 'this method' * Merge branch 'main' into explicit-resource-management * Revert changes to esmeta-ignore.json * PR fix type and function/method usage * Additional editorial feedback * Refactor out DisposeCapability * Fix internal slot typo * Remove unused Dispose AO * Editorial feedback * Remove excess argument to 'return' method * Restore 'then' in assertion * Restore old ids * SuppressedError.prototype description * Revert 'this function'->'this method' * 'property'->'properties' in (Async)Disposable interface desc * Other editorial feedback * no list for mutually exclusive states * Align aliases with tc39#3873 * PR feedback * Symbol description wording * Merge pull request #17 from rbuckton/excess-iter-return-argument Remove excess argument to 'return' method * Revert function->method changes
using and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStackusing and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack
d7e588c to
f792966
Compare
…isposableStack, and AsyncDisposableStack Normative: Add missing Symbol.dispose and Symbol.asyncDispose properties Editorial: Restrict IsUsingDeclaration to plain 'using' tc39/ecma262#3000 tc39/ecma262#3894 tc39/ecma262#3907 Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
…isposableStack, and AsyncDisposableStack Normative: Add missing Symbol.dispose and Symbol.asyncDispose properties Editorial: Restrict IsUsingDeclaration to plain 'using' tc39/ecma262#3000 tc39/ecma262#3894 tc39/ecma262#3907 Co-authored-by: Ron Buckton <ron.buckton@microsoft.com>
This PR contains the Stage 3 specification text for Explicit Resource Management.