Re:Go 1.18
by int_19h on Tuesday March 15, 2022 @10:56PM
(#30694826)
Exceptions can still be treated as syntactic sugar for EaV; it just means that every expression has an implicit unwrap-and-propagate.
[ Parent
| on HN ]
Re:Go 1.18
by kevinmgranger on Wednesday March 16, 2022 @11:58AM
(#30700436)
Definitely. But Go's boilerplate for error handling is an overcorrection from the implicit propogation. As folks have mentioned, Rust's `?` or Swift's `try` strike a nice middle ground.
are there any languages that do this? Rust's `?` is similar but the propagation is explicit
That's what I'm saying - any language with exceptions can be treated as if it was all Rust-style Result<T, E>, but with implicit ? after every expression. Well, and E is an open variant (like e.g. extensible variant types in OCaml), unless the language has checked exceptions like Java.