Say imagine I had ``` fun fopen(path: String, mod...
# announcements
j
Say imagine I had
Copy code
fun fopen(path: String, mode: String): File {
    contract {
        mustBeClosed()
    }
}
a
The question is, when must a File be closed?
j
Before the end of the program.
a
so having a
file.close()
anywhere in the code would be enough?
j
Maybe
I get how it becomes a bit halting problemy
a
The compiler would need to analyze the flow of execution to find out if you ever call
file.close()
down the road which is really hard and in some cases (e.g. with threads involved) it gets impossible
j
I just said that