2 ms·
> I think the biggest problem with error verbosity is just that you have to also return zero values for the success results I agree, and this got worse with ge
by tommiegannert 4y ago
> I think the biggest problem with error verbosity is just that you have to also return zero values for the success results
I agree, and this got worse with generics since T{} doesn't work, and we have to use *new(T), which is quirky.
However, I wonder if we just want an Optional/Maybe type that has support for multiple values. Without variadic/recursive generics, we'd need compiler support. But a tagged union would get rid of the zero-values.
(I somewhat agree about the io.Reader case where returning both the number of "screwed up" bytes and an error can be useful, though perhaps the number of bytes should be encoded in the error type instead. I rarely care about them.)
- masklinn 4y ago> (I somewhat agree about the io.Reader case where returning both the number of "screwed up" bytes and an error can be useful, though perhaps the number of bytes should be encoded in the error type instead. I rarely care about them.) Or you can just keep it as-is because it's one of the very few cases where it does make sense to have a product type.