Extend type hints to cover exceptions

Checked exceptions are widely (but not universally) recognised by the programming community as a terrible idea that causes more problems that it solves.

Very few languages have copied Java by introducing checked exceptions. Probably the most well known one is Nim, and they recommend against using exceptions at all.

If you have never heard of Nim, consider that checked exception languages only get more obscure from there.

Popular mainstream languages influenced by Java such as C#, Scala and Koitlin have left checked exceptions out. For example, one of the C# designers explained why.

Even in the Java community, I have never come across anyone who actively loves checked exceptions, attitudes tend to vary from “well they’re not so bad, you’re just using them wrong” to dislike and worse:

I find it telling that even defenders of checked exceptions will often complain that they are hard to use and often misused. This stackoverflow comment gives Haskell as an good example of checked exceptions done right, with the minor complication that they aren’t exceptions at all. :-/

In fairness, not everyone thinks they are an outright mistake but even the supporters acknowledge that they are very difficult to use correctly.

15 Likes