Hacker News new | past | comments | ask | show | jobs | submit login

There's also a usability problem.

Handling results with map, map_err and .ok is way easier to follow that the minimum 4 lines you have to add in Java to do anything about a checked exception (try {} catch {}).

Explicit error handling/ignoring/passing is way better than implicit, so the direction of checked exception is good.

The debate is not really checked exceptions vs Result, it's try/catch vs map_err (and friends). And will always chose the latter.




But, this isn't you complaining about checked exceptions vs Result. This is you complaining about Java's overall syntax style vs Rust's.

Phrased another way, Java's syntax is fairly verbose for everything, not just for try-catching to handle exceptions.


I don't know any language that has exceptions and also has no try/catch type syntax.

> But, this isn't you complaining about checked exceptions vs Result

Yes, I said so exactly

> The debate is not really checked exceptions vs Result, it's try/catch vs map_err (and friends)

The fundamentals are the same, you are forced to handle/discard/Buble up any error, but in my mind (and I assume a lot of other developers), the word "exception" means try/catch, even though like I said the fundamentals are the same.


A simple usability improvement for try..catch in Java would be to make it an expression, so initializing a variable with a fallible operation no longer requires declaring it outside, which is ugly.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: