Try-with-resources: the Kotlin way?

Great :) I'm looking forward to have the possibility to manage resources safely. Safety first ;)

I’m curious how the resource context would work. Obviously, I don’t know Kotlin well enough to see the way how to provide an instance of the resource context (assuming it is just a library class with some hooks called by the autoClose and using functions) to invocations of autoClose within the appropriate scope. Knowing this technique would be… hm, inspiring, I would say. For example, the same technique could, for instance, support explicit library locks (safe lock-unlock) in more complex deadlock-preventing locking scenarios.

I assume that the facility can cope with exceptions thrown by the resource release function or the using block can be nested: for instance I want split a file into several other files sequentially, so I have a using block for the source source, a loop in the block and in the loop again a nested using block for the target file.

Perhaps yet one more question, remotely related: Java 7 introduced suppressed exceptions, which works exceptionally well with try-with-resources. Will that be supported in Kotlin as well?

I will definitely stay tuned!