For example, something like this should be possible:
scoped {
RawFileReader reader <- RawFileReader$open("file")
} cleanup {
reader.freeResource()
} in {
// some procedure using reader
}
At the moment, the closest alternative (semantically) is something like:
scoped {
RawFileReader reader <- RawFileReader$open("file")
// some procedure using reader
} cleanup {
reader.freeResource()
} in scoped {
// some procedure using reader
} in ~ empty
scoped was originally meant to act like {} scoping in C++, while also encouraging the user to separate scoped variables from the sub-procedure that uses them. We therefore don't want to generally allow {} scoping outside of scoped/cleanup.
For example, something like this should be possible:
At the moment, the closest alternative (semantically) is something like:
scoped
was originally meant to act like{}
scoping in C++, while also encouraging the user to separate scoped variables from the sub-procedure that uses them. We therefore don't want to generally allow{}
scoping outside ofscoped
/cleanup
.