2 ms·
The thing sum types would allow is to make a clear distinction between functions that return either a result or an error and functions that can return both a re
by Zababa 5y ago
The thing sum types would allow is to make a clear distinction between functions that return either a result or an error and functions that can return both a result and an error. Many functions in Go will always return either res, nil or nil, err. Those functions would benefit from a way to show that in the signature, to differentiate them from the functions that can return res, err at the same time. This is not a replacement for multiple return values, as there are many cases where multiple return value are useful.