3 ms·
One reason checked exceptions are a not great is that library authors would like you to implement their interfaces or extend their classes, but they've decided
by anonymoushn 5y ago
One reason checked exceptions are a not great is that library authors would like you to implement their interfaces or extend their classes, but they've decided that you can't throw anything :)
Zig actually does pretty well on this front. you can write a library that accepts functions that return errors, and your functions will be specialized to return those errors in addition to their own if you don't handle them. Callers who want to handle errors exhaustively with a switch will get compile errors if the error set changes and they fail to handle new errors.