interface and use extension is not in the common stdlib?
👍 1
t
Tomasz Krakowiak
04/19/2021, 3:18 PM
I guess it might an overlook. There's #stdlib channel.
b
Big Chungus
04/19/2021, 3:22 PM
Will shamelessly cross-post 😈
Big Chungus
04/19/2021, 3:22 PM
Oops, you've beat me to it 😄
l
louiscad
04/19/2021, 4:50 PM
Because it's very JVM specific I think.
b
Big Chungus
04/19/2021, 4:52 PM
Since kotlin doesn't have destructors, this seems to be the next best thing. Also there are closeable resources in any platform.
l
louiscad
04/19/2021, 5:46 PM
When I say it's a very JVM thing, I mean it's an API that comes straight from the JVM, and the
close
function can throw
IOException
, again, a very JVM thing (nowhere to be found in platforms supported by Kotlin/Native for example.
API-wise, it's a bit complicated to support that forever I think, because it might not be the best abstraction for resource releasing, and Kotlin might lack the facilities or consistency across supported platforms (i.e. shared XOR mutable on native for now) to allow for a better solution.
g
gildor
05/10/2021, 8:01 AM
one more issue is that this interface wouldn’t be used on stdlib itself. so it will be just a convention
Though, I think it’s reasonable to add it, but again, it opens other questions, like should
close()
be suspend and how it should work with java Closable/AutoClosable