It creates an open file object that points to the provided file descriptor fd argument. The docs suggest that it can be obtained by calling sys_open or sys_connect
There are a few issues with this function that should be addressed. First, should we keep it? #20128 proposes removing the type used to define its fd argument, does that imply that it should also be removed? We could replace the type with c_int since that is the equivalent type, but c_int is more low-level than most of the other parts of the IO module interface.
Does that imply it should live somewhere other than the IO module, if we do decide to keep it? It does create a file type, which is defined in the IO module, and is in a similar vein to open and other similarly named functions, which we have no reason to believe will live anywhere other than the IO module.
If we do decide to keep it, we should probably rename it. Some options we've thought of include:
openFD
openFd
openFileDesc
openFileDescriptor
make it a factory function on the file type, e.g. file.fromFD or file.fromFileDesc, since it's likely already open as a result of the two suggested ways to obtain it?
make it an initializer on the file type, for a similar reason?
So, the questions:
Should we keep this function?
If so, should it live in the IO module or somewhere else?
And if we should keep it, what should we rename it to?