Implicit close for I/O objects, revisited


#1

There was some discussion and an issue item about lacking an explicit close method on file and socket objects, and the problems with calling the OS close function implicitly in those objects’ destructors. While a somewhat lackluster and OS-specific solution for explicit closing was provided with IntoRawFd, the destructor still calls close ignoring possible errors. This makes error-ignorant usage the most convenient to write. Furthermore, this may cause the thread to block, possibly on unwind, which, as I have just discovered, is contrary to the emergent API guidelines.

Are there some future developments envisioned to deal with this problem within the standard library?