tc39 / proposal-explicit-resource-management

ECMAScript Explicit Resource Management
https://arai-a.github.io/ecma262-compare/?pr=3000
BSD 3-Clause "New" or "Revised" License
725 stars 28 forks source link

Fix missing lookahead restriction #222

Closed rbuckton closed 2 months ago

rbuckton commented 3 months ago

This fixes a missing lookahead restriction to prevent export await using like we do for export using that was overlooked when we chose await using over using await.

The PR against ecma262 is being tracked in https://github.com/rbuckton/ecma262/pull/4

github-actions[bot] commented 3 months ago

A preview of this PR can be found at https://tc39.es/proposal-explicit-resource-management/pr/222.

rbuckton commented 3 months ago

I should note that this is another bugfix intended to align with consensus.

rbuckton commented 3 months ago

Editorially lgtm, though I don't recall the particular consensus atm and happy to take your word for it.

This was a long time policy since the adoption of RAII mechanics in Stage 2. There is no reason to export a disposable since it will be disposed as soon as the module finishes loading, so we banned export using (and export using await, prior to the syntax switch). We do still permit using x = ...; export { x }; if the user has a specific need for that ability, but we still want to discourage the simple form as it is more than likely an indication of a bug.