Closeable
and Closeable.use
are a very standard pattern.
So, I am very curious as to why it has not been included in the common standard library.
Closing low-level resources is a common problem, especially in Kotlin/Native.
Some libraries, such as KotlinX/IO are providing their own Closeable
/ use
, but I don’t want to depend on KotlinX/IO just for access to Closeable
!
Therefore, I ended up duplicating Closeable
/ use
in my own multiplatform libraries, which is by essence a very bad idea .
I searched common Kotlin places (discuss, youtrack, github) and couldn’t find any mention of this.
Any reason why Closeable
is NOT in the common standard library?