Re:Why Go's Error Handling Is Awesome
by learc83 on Tuesday July 07, 2020 @09:35AM
(#23759075)
That’s hardly a reason not to include a maybe type. In that particular case, instead of a maybe you can use a combination of sum and product types or just an additional ShortRead type.
NormalRead | ShortRead | Error
This case is also an example of why go’s idiom of using error value or return value doesn’t always work.
If you had a maybe type and a general sum type it would be clear when a function was going to return either or both.
NormalRead | ShortRead | Error
This case is also an example of why go’s idiom of using error value or return value doesn’t always work.
If you had a maybe type and a general sum type it would be clear when a function was going to return either or both.