kael
12/06/2017, 1:35 PMdeinit in Kotlin/Native?elizarov
12/06/2017, 1:41 PMkael
12/06/2017, 1:50 PM.destroy() (or whatever) on the soon-to-be-deleted object. With Kotlin/Native being reference-counted similar to Swift (correct me if I'm wrong here), I figured it might be possible to do what Swift did with deinit.kael
12/06/2017, 1:50 PMkael
12/06/2017, 1:55 PMmemScoped, and that I'm talking about storing the resource as a class member variable in the wrapper class. So this is not about using the resource in a limited scope or anything.elizarov
12/06/2017, 2:03 PMArena to the wrapper class that stores the allocated resource. Arena is designed to serve as a drop-in replacement for RAII patternolonho
12/06/2017, 2:04 PMolonho
12/06/2017, 2:06 PMkael
12/06/2017, 2:11 PMkael
12/06/2017, 2:11 PMArena to be found somewhere?olonho
12/06/2017, 2:16 PMr4zzz4k
12/06/2017, 2:31 PMDeferScope, which is implemented by AutofreeScope and Arena, does have the method defer(), which can be used similarily to Go's defer. Do I understand this correctly?
Also, for my needs I added facilities similar to java.io.Closeable and kotlin.io.use. I would probably add extension method to register objects implementing this interface in DeferScope. Any chance something similar would be implemented in the stdlib?kael
12/06/2017, 2:51 PMsvyatoslav.scherbina
12/08/2017, 7:09 AMOh, soYes. It defers the lambda to be executed on arena disposal or, which is implemented byDeferScopeandAutofreeScope, does have the methodArena, which can be used similarily to Go’sdefer(). Do I understand this correctly?defer
memScoped end.
Also, for my needs I added facilities similar toResource management in Kotlin/Native is under a (long) discussion now, but we haven’t decided yet what exactly to be added to stdlib.andjava.io.Closeable. I would probably add extension method to register objects implementing this interface inkotlin.io.use. Any chance something similar would be implemented in the stdlib?DeferScope
r4zzz4k
12/08/2017, 8:12 AM