Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

馃搸 Implement the new resource managment proposal #4646

Closed
ematipico opened this issue Jul 2, 2023 · 7 comments 路 Fixed by #4759
Closed

馃搸 Implement the new resource managment proposal #4646

ematipico opened this issue Jul 2, 2023 · 7 comments 路 Fixed by #4759
Assignees
Labels
A-Formatter Area: formatter A-Parser Area: parser I-Normal Implementation: normal understanding of the tool and awareness L-JavaScript Langauge: JavaScript task A task, an action that needs to be performed
Milestone

Comments

@ematipico
Copy link
Contributor

ematipico commented Jul 2, 2023

Description

Context https://github.com/tc39/proposal-explicit-resource-management

Tests for formatter: https://github.com/prettier/prettier/pull/14862/files

Syntax:

using resource = await instance.lock();
//^^^ new grammar

using is just a new variable kind, so it will be very straight forward to implement it.

@ematipico ematipico added the task A task, an action that needs to be performed label Jul 2, 2023
@ematipico ematipico added this to the v13.0.0 milestone Jul 2, 2023
@ematipico ematipico added A-Formatter Area: formatter L-JavaScript Langauge: JavaScript A-Parser Area: parser I-Normal Implementation: normal understanding of the tool and awareness labels Jul 2, 2023
@nissy-dev
Copy link
Contributor

I'll take this issue!

@nissy-dev nissy-dev self-assigned this Jul 7, 2023
@nissy-dev
Copy link
Contributor

nissy-dev commented Jul 7, 2023

As I started working on this task, I found that using declaration is easy, but wait using declaration is difficult to implement.

I've tried defining it like this for babel (see: babel/babel#15520), but it doesn't seem to work

JsForVariableDeclaration =
	kind_token: ('var' | 'let' | 'const' | 'using' | 'await using')
	declarator: JsVariableDeclarator

I'm having trouble figuring out how to handle await using.

@ematipico
Copy link
Contributor Author

You can develop feature progressively if you prefer.

Here you can check the semantic changes to the language: https://arai-a.github.io/ecma262-compare/?pr=3000 (on the right there's a small widget with arrows, you click them and jump to the next difference).

We start by:

  • investigating how babel and TS are doing it, if they are adding new nodes to support the new syntax
  • investigating the TC39 changes to the language and what they added/changes
  • discuss here the changes, no need to jump coding straightaway

@arendjr
Copy link
Contributor

arendjr commented Jul 28, 2023

Any progress on this issue? If I have some time left, I might be able to offer some help.

@ematipico
Copy link
Contributor Author

Hi @arendjr , thank you! Feel free to help. There hasn't been any update, so feel free to take it

@ematipico
Copy link
Contributor Author

@arendjr heads up, @nissy-dev opened a PR. If you're still interested, we can all work at helping him to ship the feature and fix regressions as we go

@arendjr
Copy link
Contributor

arendjr commented Jul 30, 2023

Great! I had made a small start already, but that鈥檚 no problem. It should put me in a good position to give a review at least.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter A-Parser Area: parser I-Normal Implementation: normal understanding of the tool and awareness L-JavaScript Langauge: JavaScript task A task, an action that needs to be performed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants