2 ms·
> The stereotypical example of multiple returns in Go is functions that return val, err when they mean that they return one of a value or an error. Which is wha
by josephcsible 4y ago
> The stereotypical example of multiple returns in Go is functions that return val, err when they mean that they return one of a value or an error. Which is what sum types do.
The point is that with real sum types, the compiler will enforce that you return exactly one of a value or an error, whereas in Go, you're just supposed to do so, and it's possible to write code that mistakenly returns both or neither.