Linus’s proposal for Result<T, E> seems a lot like the Golang approach to things where you almost always return a value and an error.
I’m not a rust developer and a very weak go dev so take the above as you will.
I’m not a rust developer and a very weak go dev so take the above as you will.
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.