3 ms·
The tradeoff is complexity. You need to define a maybe for your return value, which needs generics. Whereas Go gets 80% of the functionality with multiple ret
by NateDad 12y ago
The tradeoff is complexity. You need to define a maybe for your return value, which needs generics. Whereas Go gets 80% of the functionality with multiple returns which are like 10% odd the complexity (and are useful in other ways).
- pcwalton 12y agoYou don't have to have generics to use enums for error handling any more than you need generics to use tuples for error handling. The thing you need is enums/algebraic data types/sum types. See for example the first answer to this SO question on error handling in Swift, which doesn't use generics at all: http://stackoverflow.com/questions/24010569/error-handling-in-swift-language http://stackoverflow.com/questions/24010569/error-handling-i...