Checked errors are not unique to Java. Rust, HNs darling baby, is praised on this forum every day for checked errors. Swift, F# and countless other languages have checked errors.
There is nothing wrong with checked exceptions and there is really no difference between a Result and a function with a checked exception.
The issue is not with checked exceptions but with Java’s syntax. They have not given programmers the language syntax to easily deal with checked exceptions. You cannot easily escape them without boilerplate and they don’t work correctly across lambdas. This is why Rust ships with ?; Swift has shipped with try!, try?; and Scala ships with try as an expression and is experimenting with checked exceptions that work across high order functions [0].
Programmers across every language ecosystem are moving towards checked errors and away from unchecked runtime crashes. Even Kotlin, a language that shipped with unchecked errors, is planning on adding a form of checked error handling [1].
There is nothing wrong with checked exceptions and there is really no difference between a Result and a function with a checked exception.
The issue is not with checked exceptions but with Java’s syntax. They have not given programmers the language syntax to easily deal with checked exceptions. You cannot easily escape them without boilerplate and they don’t work correctly across lambdas. This is why Rust ships with ?; Swift has shipped with try!, try?; and Scala ships with try as an expression and is experimenting with checked exceptions that work across high order functions [0].Programmers across every language ecosystem are moving towards checked errors and away from unchecked runtime crashes. Even Kotlin, a language that shipped with unchecked errors, is planning on adding a form of checked error handling [1].
[0] https://docs.scala-lang.org/scala3/reference/experimental/ca... [1] https://youtrack.jetbrains.com/issue/KT-68296