Closed
Description
I recently wrote the following to get some behavior like a 'finally' block:
resource finally(ch: comm::chan<monitor_msg>) {
comm::send(ch, done);
}
let _finally = finally(ch);
What I really wanted to write was:
defer {||
comm::send(ch, done);
}
Or something structured like try/finally.
I tried to devise some way to write a defer
library function but there doesn't seem to be any safe way to do it since blocks can't be put into resources.