3 ms·
Go has functions with multiple return values. That's not at all the same.
by wasted_intel 9y ago
Go has functions with multiple return values. That's not at all the same.
- weberc2 9y agoI didn't talk about multiple return values, did I? Every language has error handling support, some languages hijack an exception mechanism as a control flow path for non-exceptional error states. Returning error values is more ergonomic than exceptions, but Go's lack of sum types makes this slightly tedious (still better than exceptions).
- wasted_intel 9y agoRight, I jumped ahead; multiple return values is the how Go returns error values, it's not error handling itself. I don't like exceptions much either, but sum types / ADTs are just so nice for this sort of thing.
- weberc2 9y agoI agree that sum types are nicer, but I don't see how they constitute error handling in a way other return mechanisms do not. The difference isn't categorical, it's ergonomic.