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

Error handling #12

Open
Victorious3 opened this issue Sep 26, 2022 · 0 comments
Open

Error handling #12

Victorious3 opened this issue Sep 26, 2022 · 0 comments
Labels
proposal New feature or request

Comments

@Victorious3
Copy link
Contributor

Victorious3 commented Sep 26, 2022

Current option is to use multiple return values for errors.
However, this doesn't seem to be adequate as the case of Golang is proving to be.
It would be useful if you can bubble up errors automatically. Could look something like this:

def throwing_function throw -> int {
	throw "Some error message"
}

And then you can catch it like so:

let i = throwing_function() except e {
	print(e)
}

Or you tag the enclosing function with throw to bubble up the error.
"Exceptions" would have to implement ToString.
A normal try catch might also be possible but I'm not sold on that idea.
It would also make future developments like async await a bit more complicated. You can basically get the same thing with a closure that throws.

@Victorious3 Victorious3 added the proposal New feature or request label Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant