[HN Gopher] Wrong by Default
       ___________________________________________________________________
        
       Wrong by Default
        
       Author : zdw
       Score  : 9 points
       Date   : 2022-05-15 19:14 UTC (3 hours ago)
        
 (HTM) web link (kevincox.ca)
 (TXT) w3m dump (kevincox.ca)
        
       | nie100sowny wrote:
       | I wonder why in the middle of 2022 people still put pre-2011 and
       | pre-JDK7 snippets. And even try-with-resources example is not all
       | what JDK7 provides, there are better, high-level utilities added
       | which haven't got a proper attention.
       | 
       | Namely, in JDK7 and newer, you can just write:
       | Files.readAllBytes(Path.get("story.txt"))
        
         | pkolaczk wrote:
         | The point of the article was to compare how resource cleanup
         | works in general in different languages. What you show here is
         | a very special case that does not extend to other resources or
         | even other file operations. Still, try-with-resources and
         | AutoClosable is the best what Java has to offer, and it is
         | clearly inferior to Rust/C++ approach (and to some degree also
         | to Go and Zig, but less so).
        
       ___________________________________________________________________
       (page generated 2022-05-15 23:02 UTC)