The difference so far as I can make out is… with forcing explicit casts we’re insisting the developer patronises the compiler by asserting that he/she knows what he/she is doing. Without explicit casting we are saying to the compiler effectively that we are unaware that this cast operation might fail and therefore we are poor stupid humans.
However, the runtime catches the problem.
The same argument goes for checked vs. unchecked exceptions. The whole idea of forcing people to catch checked exceptions is daft, especially when it ends up with this appearing everywhere:
try {
...
} catch (Exception e) {
e.printStackTrace(System.err); // This is not handling, this is IGNORING
// or worse.. TODO: handle exception but output nothing until someone writes some code
}
Again, as all exceptions are caught and meticulously detailed by the runtime, all we’re doing is polluting readable code with failure handling everywhere when there is actually already a perfectly robust failure handling mechanism in the JVM. As an example of just how lame this is look no further than RemoteException.
You may attempt to make a counterargument that expected exceptions (oxymoronic) need to be handled correctly, but then you have to assume that any method call can fail at any time for any reason through the long list of unchecked exceptions that can already be thrown anyway (eg. NPE, CCE, IOOBE, OOME, etc).
Final nail in the coffin is that C# does without them and they have mysteriously suffered a grand total of 0 problems as a result.
Cas