3 ms·
> The ways in which a function can fail should absolutely be part of its signature The problem with that is that a downstream library gets welded to the specif
by bsder 5y ago
> The ways in which a function can fail should absolutely be part of its signature
The problem with that is that a downstream library gets welded to the specific errors it can throw and can't evolve.
So, what everybody will do is generate the most generic "Error" possible so that the signature never needs to change. That is NOT an improvement.
- kinjba11 5y agoI think there's a nice middle ground. For instance, in Swift a function can indicate that it throws, which is better than nothing. func canThrowErrors() throws -> String func cannotThrowErrors() -> String