withFile defeats dead handle closure
Viktor Dukhovni
ietf-dane at dukhovni.org
Wed Dec 30 21:46:45 UTC 2020
On Wed, Dec 30, 2020 at 04:39:52PM -0500, David Feuer wrote:
> The handle will not be closed early if it becomes unreachable within
> the user action (without the user closing it). It sounds like the
> consensus is that that's how it should be, so I'll leave that well
> enough alone.
I see, the converse of what I guessed you were saying. I agree this is
not worth changing. It would amount to relying on GC to close the
handle perhaps a bit earlier, and my take is that any such reliance is a
bug.
If the action keeps executing long after the file is no longer needed
then the programmer used "withFile" in too broad a context and needs to
narrow its scope to just the portion of the code that is actually using
the file.
--
Viktor.
More information about the Libraries
mailing list