News for hackers. Stuff that matters.
Re:Ask HN: Why do langs with alleged “automatic memory manag... by pmontra on Thursday July 18, 2019 @04:53PM (#20473828)
Some languages (Python, Ruby, probably dozens of others) have constructs along these lines

  with f = open("data.txt")
    print f.readline()
The file is automatically closed at the end of the block. Those languages also have explicit open/close/seek calls to let the developer implement more complex cases.

Btw, the os closes any open file when the program ends.

Re:Ask HN: Why do langs with alleged “automatic memory manag... by ErotemeObelus on Thursday July 18, 2019 @05:16PM (#20473993)
Yes, you're correct that os's have some kind of rudimentary reference counting for files, but it's very inchoate and not designed as the primary method of handling file references.