Maybe I’m not following some of the above, but I have a suggestion that seems to address some of these issues:
Kotlin should infer which exceptions a method or lambda could throw, without requiring an explicit @Throws declaration.
Java’s checked exception handling has two parts: if you’re doing something that could throw an exception, you either have to catch the exception, or declare it.
Of those two, catching an exception is a local matter; it’s all dealt with within the method, and no-one else needs to know. So removing that requirement doesn’t itself have wider effects. (It might help if an IDE warned about uncaught exceptions, for people who want to know about them.)
But declaring them is where you get the bigger interactions. And it’s a pain, because in almost all cases it’s boilerplate; the compiler already knows which exceptions you haven’t caught, and so could generate that declaration for you. (Kotlin added lots of type inference already; in some ways, it’s strange they didn’t add this too.)
This inference would improve interoperability with Java code: when calling Kotlin methods, it would always know which exceptions could arise, and so Java’s strong exception checking would still apply; and the declaration would still ‘bubble up’ to the point it’s caught, whichever combination of languages were used.
It wouldn’t make exceptions ‘checked’ in Kotlin; Kotlin code would still be free to ignore them. But the information about them would no longer be lost; at any point in the code you’d always know which exceptions could be thrown, so you could make more informed decisions about what to handle.
The problem case is around lambdas; that’s where things get painful in Java. But in Kotlin, most lambdas get inlined, so this shouldn’t be a problem! (I’m not sure what should happen where they’re not inlined; perhaps the compiler can do something akin to type parameterisation? Or maybe that would have to be a corner case it doesn’t handle.)
To me, this sounds the best of both worlds, giving developers all the information they’d get from checked exceptions, without requiring any extra code.