3 ms·
Does one have to know all of the pathological corner cases in language X in order to be allowed to state "I know X" without being categorically wrong? Does the
by sofal 17y ago
Does one have to know all of the pathological corner cases in language X in order to be allowed to state "I know X" without being categorically wrong? Does the fact that it is possible write funny little gotchas in language X make a point about the inferiority of X?
- codexon 17y agoNo but too many of them are an indicator of poor design. An example of this is C++ and the sheer number of gotchas presented by Herb Sutter and others: http://www.gotw.ca/gotw/ http://www.gotw.ca/gotw/
- axod 17y agoIf you're doing break or return from within a finally{} block, the problem of design is your own doing if the results are surprising to you. The only real life gotcha I had with Java very early on was the realization that a++ isn't an atomic operation :/
- lucifer 17y agoBut that is clearly not the case here. There are no gotchas. Basic scoping rules and an understanding of "finally" and "break".
- gcv 17y agoThere aren't any "corner cases" or "gotchas" in these examples. I even fed the examples to javac to confirm my answers. Just to see if something changes, I then translated the examples to Python, and found that Python does exactly the same thing as Java. It's really, really simple stuff, and anyone who ever wrote a "finally" clause to clean up a file handle should understand it. So the author's assertion, that most people in his audience had no idea what that code does, really just shows that his audience consisted of idiots.
- lucifer 17y agoI did the same (for Java). No surprises. But this did surprise me: try { throw new Exception ("exception"); } finally { throw new Exception ("finally"); }
- manus_eiffel 17y agoThe audience was mostly full of professors and PhD students, I would not call them idiots.
- robryan 17y agoI think it really depends if java is a language you know or java is a language you work with every day. I think it's ok to be rusty on some specific cases until the time comes to use them if you don't use a language all the time.