proposal-explicit-resource-management
proposal-explicit-resource-management copied to clipboard
ECMAScript Explicit Resource Management
This is an alternative to #216 and is based on another fix in #218. Per https://github.com/tc39/proposal-explicit-resource-management/issues/196#issuecomment-1646145514, this reduces the number of `Await`s in blocks containing `await using` and in `AsyncDisposableStack`...
The [CoverAwaitExpressionAndAwaitUsingDeclarationHead](https://tc39.es/proposal-explicit-resource-management/pr/220/#prod-CoverAwaitExpressionAndAwaitUsingDeclarationHead) and [AwaitExpression](https://tc39.es/ecma262/#prod-AwaitExpression) grammars are identical, so I'm curious about the editorial decision to reparse in that case. The proposal includes instances of static semantics reparsing a [CoverAwaitExpressionAndAwaitUsingDeclarationHead](https://tc39.es/proposal-explicit-resource-management/pr/220/#prod-CoverAwaitExpressionAndAwaitUsingDeclarationHead) as...
During implementation we realized the following cursed code is possible: ```javascript switch (lbl) { case 0: using x = init(); break; } ``` AFAIK other than this, declarations aren't conditionally...
There has been some interest in changing the behavior of `using` and `await using` slightly to guide users towards `using` over `const`. In #49 there is a more comprehensive discussion...
This brings in PR feedback and cleanup from https://github.com/tc39/ecma262/pull/3000.
The `AsyncDisposableStack.use()` is equivalent to `await using`. But there's no API equivalent to `using` on `AsyncDisposableStack`. This can lead to subtle behavior difference if there's async race: ```ts import {...
Like here:  That causes such issues: https://github.com/nodejs/node/issues/48699
@ljharb... my apologies if this has already been discussed and I just missed it, but what would be expected to happen in the following case: ```js { using foo =...
The Semantics section of the README emphasizes that `using x = expr1, y = expr2;` (multiple bindings in a single declaration) is only [*approximately* equivalent][using-emphasis] to `using x = expr1;...