Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a tentative cover grammar to reintroduce
UsingStatement
and removesusing await const
, per this comment. Specifically, the following syntax is used:const
has been removed from all declarations/statements in favor of treatingusing
as a contextual keyword. This helps to reinforce thatusing
has different behavior from a normalconst
in that it has side effects at the end of the block, does not allow destructuring, and supports thevoid =
form which allows capturing a resource for disposal without introducing a binding. We have also dropped theusing (expr) { ... }
form in favor of theusing (void = expr) { ... }
form which is more consistent between the statement and declaration forms.These changes help to create a clear parallel between the
using
Declaration andusing
Statement:As well as a clear parallel between the
using
Statement andusing await
Statement:This allows us to continue to have first-class syntax support for
Symbol.asyncDispose
(via theusing await
statement), as well as RAII-style resource declaration forSymbol.dispose
(via theusing
declaration). We can then potentially introduce ausing await
declaration form in the future if we find an acceptable compromise regarding the implicitawait
at the end of the block.