Add using and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack#3000
Add using and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack#3000
using and await using Declarations, SuppressedError, DisposableStack, and AsyncDisposableStack#3000Conversation
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 |
I suggested `variants="Disposable object"` because I suggested putting <dfn> around "Disposable interface" (similar to the dfn for other interfaces). If instead you put <dfn> around only "Disposable", then you don't need the variants attribute, because any occurrence of "Disposable object" will get the "Disposable" auto-linked. Ditto AsyncDisposable.
(Insert appropriate algorithm.)
An ExportDeclaration is a ModuleItem, not a Declaration, so I don't think IsUsingDeclaration or IsAwaitUsingDeclaration would ever be applied to an ExportDeclaration.
IsFunctionDefinition, AssignmentTargetType, and HasCallInTailPosition already have explicit rules for CoverAwaitExpressionAndAwaitUsingDeclarationHead, and AwaitExpression only arises by reparsing CoverAwaitExpressionAndAwaitUsingDeclarationHead, so those SDOs would never reach AwaitExpression.
At this point, you know that _method_ is present, and therefore must be a function object, and so IsCallable(_method_) must be *true*, so this step can't do anything.
The use of _env_.[[DisposeCapability]] assumes that _env_ is a Declarative Environment Record, though I'm not sure that's the case.
bf962d5 to
878e362
Compare
|
Thanks for the changes, LGTM except for the explicit https://tc39.es/ecma262/#sec-%iteratorhelperprototype%.return
https://tc39.es/ecma262/#sec-generatorstart
https://tc39.es/ecma262/#sec-generatorresumeabrupt
I believe this is sufficiently clear and we should not assign values that are impossible to observe. |
I don't have a strong preference, though I'm wary of the hand-wavyness of just using a NOTE for a feature explicitly focused on resource/memory cleanup. |
|
@rbuckton I made a handy flowchart
|
|
Re Assert vs Note in the diagram: I'm not sure how I'd discern whether something is an invariant. My preference is that an Assert's condition should be something that, if you were working out an example and got to that step, you could actually check and confirm its truth at that point. (So, e.g., a statement about the future should be a Note, not an Assert.) |
|
@jmdyck The point was just that "you have an opportunity to do cleanup here" is definitely not an invariant, and it also doesn't impose a normative requirement, so it's either fluff or it's a note. |
|
You should add
(I had a commit to do this, but there was a rebase problem.) |
|
I suggest changing "This function" to "This method" for:
|

This PR contains the Stage 3 specification text for Explicit Resource Management.