3 ms·
You've never seen the Java "pattern" of try { foo(); } catch (Exception e) { ; } ?
by jfb 11y ago
You've never seen the Java "pattern" of
try {
foo();
} catch (Exception e) {
;
}
?
- mcguire 11y agoThis is not idiomatic Java code and in my experience not many competent people will do this. New Java programmers who ask for help with a piece of code that ignores the error are told immediately to check the error. And experienced Java programmers simply do not ignore the error. Also, you don't need the semicolon.
- jfb 11y agoIt's not idiomatic, or good, but neither is ignoring the return value from a go function call. Both languages fail to provide better affordances for error checking.
- mcguire 11y agoThat it's bad style is kind of the point: The standard response from Go advocates is that ignoring errors is not idiomatic, but it's not good style anywhere, in any language where it isn't outright illegal.
- jfb 11y agoI think we're in violent agreement. I wasn't saying that Go's affordances solve this problem, merely pointing out that checked exceptions in Java aren't any kind of a dispositive solution.