Is Java the only language that has Checked Exceptions?
I'm not asking about the definition of checked and unchecked exceptions, so please don't post a link to such a source. I'm just asking if you know a language other than Java which checks for the handling of exceptions by the programmer at compile time.
C++ used to have checked exceptions but the compiler implementors usually ignored it or enable it using compiler options. The reason was exception specification adds to the object model and makes it bulky, thus affects the performace/optimizations. The purpose of checked exception is to recover the system to a stable state before the exception occured. Due to chaning of exceptions it means the stack frame may needs to be unwind far too back in time and to do that you need a lot of internal book keeping. The memory/object and compilation model of the programming languages often make stack unwinding difficult. So now C++ allows methods to specify whether it will throw an exception or not. If you are throwing an exception deal with it else the program terminates
void fun() nothrow <-- will not throw an exception
void fun() nothrow(false) <-- can throw an exception
Exception handling is not a trivial task in any programming language.
Nice question! I'm not aware of any others. Checked Exceptions are pretty unpopular even among Java folk, so if there aren't any now, there probably won't be in the future.
In C++ there is `noexcept` which does some compile time checks to make sure a function does not throw an exception, I guess that's similar but also opposite.
And then theres languages without proper exceptions but that's also not really the same. Haskell typically communicates error with the `Either` and `Maybe` types which pass through the typechecker like everything else. (There is Control.Exception but I digress).
And for fun I'll mention Vigil, which will delete your source code when it finds an unhandled exception, to punish you. All runtime though and not really checked at all. I guess you have a compile-time contract with the runtime to be vigilant.