TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Java 7 : The new try-with-resources statement

17 pointsby buduover 14 years ago

5 comments

mahmudover 14 years ago
This is what happens when people aren't given UNWIND-PROTECT and DEFMACRO: a cottage industry of pundits and legislators will form to discuss any itches you might have, and whether to scratch them.<p>Watching Java programmers is like having a tribal shaman for a next-door neighbor. You know it's none of your business, and you respect his beliefs, but it's still unsettling to see him do one of those "hot knife in nose" and "pull stubborn goat with nipple fish-hook" rituals.<p>Come to think of it, that last trick must be what Guy Steele did to drag C++ programmers "halfway to Lisp".
评论 #1634249 未加载
ataggartover 14 years ago
<p><pre><code> (with-open [fis (FileInputStream. source) fos (FileOutputStream. target)] (do-stuff fis fos)) </code></pre> I wish they would spend less time adding stuff to the Java language (especially features present in other JVM languages), and more time fixing the core API and improving the JVM feature set. Continuations would be nice.
Tichyover 14 years ago
"java.lang.AutoCloseable interface"<p>Facepalm... (There has to be an easier way...)
评论 #1632721 未加载
评论 #1631526 未加载
fxtxrxover 14 years ago
Is this similar to C#/.NET "using" construct ?
评论 #1631590 未加载
nradovover 14 years ago
Well sure it will help a little, but if only they would add control flow closures then we could write these constructs ourselves rather than having to build them into the core language.