r/java • • Jun 10 '24

[deleted by user]

[removed]

615 Upvotes

594 comments sorted by

View all comments

Show parent comment

1

u/arobie1992 Jun 10 '24

I like Rust, and it definitely does error handling better than Go, but it has a lot of the same fundamental problems. The two largest are the default is suppressing the error and you need to manually build stack traces. Throw versus return is a valid discussion for error handling, and I think both have their pros and cons. For me, the endgame would be something that combines the best of both: default propagation, automatic stack traces, and enforced documentation via method signatures*. Checked exceptions do this to some extent, but have their own issues as well; effects systems seem like a promising field, but are still primarily academic.

*There's also some discussion about the overhead of each approach for low-latency/real-time systems, but I'm not familiar enough with that world to really have much of an opinion on it.