Comment

Comment by gw

Not the commenter but which one of these is the defer generating?

    // option 1
    try {
      fp = os.open(x)
      fp.read()
    }
    finally {
      fp.close()
    }

    // option 2
    fp = os.open(x)
    try {
      fp.read()
    }
    finally {
      fp.close()
    }
Should we close if open fails? Maybe, maybe not, but with try/finally it is obvious which one it is doing.
parent gw 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton