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

"try coalescing" / catch operator #1150

Open
bbrk24 opened this issue Apr 4, 2024 · 0 comments
Open

"try coalescing" / catch operator #1150

bbrk24 opened this issue Apr 4, 2024 · 0 comments
Labels
proposal Proposal or discussion about a significant language feature

Comments

@bbrk24
Copy link
Contributor

bbrk24 commented Apr 4, 2024

Some operator shorthand for try/catch:

x = foo() op bar()
// vvv
try {
  x = foo()
} catch {
  x = bar()
}

Suggested spellings for the operator (from Discord) include catch (with implicit try) and !! (to mirror ??). Precedence should be lower than function application.

@edemaine edemaine added the proposal Proposal or discussion about a significant language feature label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal or discussion about a significant language feature
Projects
None yet
Development

No branches or pull requests

2 participants