3 ms·
When I worked in Java (11+ years ago) the style dogma was to never use checked exceptions.
by cmrdporcupine 3y ago
When I worked in Java (11+ years ago) the style dogma was to never use checked exceptions.
- pjmlp 3y agoThat won't fly in code review in most Java shops I worked on. Also the way modern languages that are worshiped for forcing to handle return values, with pattern matching, try and ? operators, it is nothing other than proving the point checked exceptions matter, even if they come with a different flavour.
- cmrdporcupine 3y agoGood to hear. I used to get scolded for using checked exceptions. But it was the 2010s. These days I work in languages with better static guarantees. Always wanted that back then, but felt like a minority.
- pjmlp 3y agoI have been doing Java projects since 2006, and as mentioned on my edit you might have missed when replying, pattern matching, try and ? are just another way to package checked exceptions in a different coating.
- cmrdporcupine 3y agoYes and no. There's a non-local-control aspect to exceptions that's a bit different from explicit return or ? in that it's explicit in the text of the program rather than in the signature of the method. But yes, the compiler will stop you in either case, so that's fine. But there's no guarantee that someone under you didn't go and pull out a RuntimeException on you.