3 ms·
...and people are still using java?
- sofal 17y agoDoes 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.
- cnlwsu 17y agoPeople still use COBOL, it has its place. Can I write something faster that is more maintainable and readable in a different language? Yes. does it matter? Depends on the situation. That said, this article is really just picking on some odd cases which anyone can do in about any language.
- manus_eiffel 17y agoActually that the point of the article, not all languages are equivalent on this front. Some have more than others. My claim is that Eiffel is a language with very few of those.
- olliej 17y agoThis seems to basically be bitching about 'finally' (which is a perfectly legitimate thing to bitch about) -- but finally isn't java specific it also exists in JavaScript, C#, Delphi, and quite a few others (strangely however not C++, who'd have thunk it :D )
- manus_eiffel 17y agoActually C# is much better than Java in this area.
- rogeriopvl 17y ago"That's why I use Eiffel." This is just Eiffel propaganda.
- manus_eiffel 17y agoWhat do you expect? It was posted in a forum for an Eiffel audience. It is beyond my control that someone posted the link here.