Re:Declined Proposal: A built-in Go error check function, “try”
by edflsafoiewq on Wednesday July 17, 2019 @01:48AM
(#20456836)
There's nothing wrong with unwrap. It's just an assert. Even a[i] is just shorthand for a.get(i).unwrap(). Asserts are definitely appropriate in production code, just not for handling run-time errors.
Re:Declined Proposal: A built-in Go error check function, “try”
by jbverschoor on Wednesday July 17, 2019 @03:20AM
(#20457252)
Then how is this better than anything else? Except for syntactical sugar for:
Try Return [Bla(), null] Catch err Return [null, err] End
I do like this syntax better, bc the different scopes cause a lot of nesting
Your example re Go errors is incorrect. The go compiler allows you to ignore errors in returns without any compiler error.
For example
err := doThingThatErrs()
and
doThingThatErrs()
are both valid Go code.