Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite into try-expressions #53

Merged
merged 18 commits into from
Jan 20, 2025
Merged

Rewrite into try-expressions #53

merged 18 commits into from
Jan 20, 2025

Conversation

arthurfiorette
Copy link
Owner

@arthurfiorette arthurfiorette commented Jan 20, 2025

@arthurfiorette arthurfiorette self-assigned this Jan 20, 2025
@arthurfiorette arthurfiorette mentioned this pull request Jan 20, 2025
@arthurfiorette
Copy link
Owner Author

arthurfiorette commented Jan 20, 2025

Should I use undefined instead of null?

This was referenced Jan 20, 2025
Copy link
Contributor

@Not-Jayden Not-Jayden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting to see this proposal progressing 👍

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
polyfill.d.ts Outdated Show resolved Hide resolved
polyfill.js Outdated Show resolved Hide resolved
polyfill.d.ts Outdated Show resolved Hide resolved
@DavidJCobb
Copy link

DavidJCobb commented Jan 20, 2025

I'm not especially familiar with the nuances of parsing JavaScript code, so this could be a non-issue, but I see a possible parsing ambiguity: is try { foo: 5 } the start of a try-catch block (containing a label and a no-op expression statement), or is it a try-expression where the expression being tried is an object literal?

How does the parser tell them apart? (Presence or absence of catch? What if a syntax error obscures the catch?) How long does the parser have to wait before it knows the answer?

You could explicitly require that try-expression be the right-hand side of an assignment, but that precludes things like

let foo = {
   a: try await bar(),
   b: try await baz()
};

@arthurfiorette
Copy link
Owner Author

@DavidJCobb 43bb6a2

@arthurfiorette arthurfiorette marked this pull request as ready for review January 20, 2025 18:45
@arthurfiorette arthurfiorette merged commit b3db21d into main Jan 20, 2025
2 checks passed
@arthurfiorette arthurfiorette deleted the try-expressions branch January 20, 2025 18:45
@arthurfiorette arthurfiorette restored the try-expressions branch January 20, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants