4 ms·
> Even in garbage-collected languages, you still need to do things like close file objects; the runtime doesn't do so automatically when it detects that there a
by 59nadir 13y ago
> Even in garbage-collected languages, you still need to do things like close file objects; the runtime doesn't do so automatically when it detects that there are no stack references to the file.
I'd just like to say there are sane solutions out there already to things like this. With the proper abstractions you get things like custodians[0] in Racket and several alternatives in terms of "call-with-..."[1] functions that do handling for you.
These might not be the languages that are being discussed here, but they offer things like these precisely because they are not the languages discussed here right now.
[0] http://docs.racket-lang.org/reference/eval-model.html?q=custodians#%28part._custodian-model%29 http://docs.racket-lang.org/reference/eval-model.html?q=cust...
[1] http://docs.racket-lang.org/reference/file-ports.html?q=call-with#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._call-with-input-file%29%29 http://docs.racket-lang.org/reference/file-ports.html?q=call...