You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
The text was updated successfully, but these errors were encountered:
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:
And then you can catch it like so:
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.
The text was updated successfully, but these errors were encountered: