3 ms·
It shares the same important property (short-circuiting, explicit & type checkable) with Rust's `Result<>`, yes. I don't think it's a direct equivalent though
by lock1 1y ago
It shares the same important property (short-circuiting, explicit & type checkable) with Rust's `Result<>`, yes. I don't think it's a direct equivalent though
- Java's exception creates stack trace by default
- Type erasure which prevents you from doing anything "fancy" with try-catch + generic's type parameter
- You can only throw something that extends `Throwable` rather than any type `E`
- etc
But yeah sure, if Java somehow provided a standard interface & an associated operator like Rust's Try trait to handle checked exception, it would probably have a much better reputation than it has now.