4 ms·
Java's checked exceptions pretty much died when they introduced lambdas. They don't work well together, at least not in the java type system. Further, I'd say
by seppel 6y ago
Java's checked exceptions pretty much died when they introduced lambdas. They don't work well together, at least not in the java type system.
Further, I'd say that IndexOutOfBoundsException can happen pretty much everywhere, so it does not make much sense to make it a checked exception anyway.
- twic 6y ago> Further, I'd say that IndexOutOfBoundsException can happen pretty much everywhere, so it does not make much sense to make it a checked exception anyway. Indeed. I don't know of any programming languages in which out-of-bounds array access is an error whose handling is enforced by the type system (checked exception, result, etc). Ditto for numeric overflow and division by zero. I believe even Ada doesn't force error handling of these.
- fiddlerwoaroof 6y agoIt’s a bit different, but languages like Idris have type systems that can prevent out of bounds array access. I’d be interested in seeing what the exception handling equivalent is.