|
|
|
|
|
by lukasLansky
3962 days ago
|
|
Strong type system with a good support of checked exceptions would tell you what kind of exceptions can arise from every function call. If you don't check them in your function code, they would add to the list of exceptions that your function can throw. It would basically turn every function you write with return type T into Either<T, ExceptionA, ExceptionC, ExceptionH> with syntax sugar that would transfer exceptions between calls so you don't have to spend your time with constant transfering of error properties of your return objects. This would allow you to check stuff on places you desire (sometimes right after function, sometimes in the UI thread) and have tooling support for managing what is left unchecked. Let's build something like that for C# using Roslyn! Issues of Java-style checked exceptions can be overcome using proper typing with generics. |
|
Exception handling must be trained and educated. There is no silver bullet.