Re:A rough proposal for sum types in Go (2018)
by saghm on Monday November 15, 2021 @07:50PM
(#29235131)
Multiple returns are a product, not a sum; in the case of (*Foo, error), you could return nil for both, or neither, which gives you four possible combinations (nil and nil, nil and an error, Foo and nil, and Foo and an error). A sum type would not let you return both a Foo and an error, just one or the other.
[ Parent
| on HN ]
There are no comments on this comment yet.