20153, "benharsh", "IO Module: Name of method that indicates a closed/open/valid 'file'", "2022-07-01T22:07:01Z"
We intend to deprecate the file.check method. The purpose of this method is to determine whether a file is closed, or if its internal pointer is null. The pointer may be null if the file was default-initialized, or if an error occurred in the runtime.
There were three options proposed:
proc file.isClosed() : bool { } // returns true if file was closed or if pointer is null
proc file.isOpen() : bool { } // returns true if the file pointer is not null and if the file is still open
proc file.isValid() : bool { } // same as isOpen
Precedence
In Chapel:
isClosed: only channel.isClosed exists today
isValid: in the Futures module
Other languages:
I don't think rust allows for closed or invalid files to be accessible
C# doesn't seem to have a 'file' type like this, and its StreamReader seems to use null to determine validity
python has a paren-less closed property: myFile.closed, where myFile was created from a call to open