The Result<T, E> is actually Rust's aproach, which is a formal (better) version of Golang's approach.
Better as in the result is standardized, and not ad-hoc like in Golang, and must be handled to use the value.
Better as in the result is standardized, and not ad-hoc like in Golang, and must be handled to use the value.
In golang both are independent, and it's unclear whether you can or should use the ok value when err != nil. There are some interfaces that actually return both at the same time.
Yeah, that's the standardized part -- it's a tagged union. In Goland the second value might not even be an error, it's just a convention using the variadic return capabilities...
BTW there are already interesting discussions around the topic if someone wants to have a look.