Re:Lies we tell ourselves to keep using Golang
by brewmarche on Sunday December 01, 2024 @05:50AM
(#42287652)
It’s about where the error value ends up versus where the success value ends up. With sum types they both end up in the return value and are handled in the same place. Typically you will now try to let the value flow further with the typical functions (bind/bimap/map/or_else and what else we can come up with).
With exceptions they are thrown and end up somewhere else in a catch block, so the path of the success value is now distinct from the path of the error value.
Perhaps this also might be clearer: the fuss is not about the errors themselves being values, but about the entire error handling system being just values.