Comment
Comment by dcrazy
Some people might be surprised that statically typed errors have arrived so late in Swift’s life. This is because typed errors are a bad default. Without deep consideration, it is easy to design an error type that encodes too much implementation detail into the type system. Then if your implementation grows new failure modes, you either have to break your ABI (e.g. by adding a new case to your error enum) or lie about the nature of the error, calling into question the value of encoding errors in the type signature at all. And at a certain level of abstraction, it’s just impossible to predict all the failures that can occur. We learned these lessons from Java’s checked exceptions experiment.