I have seen many examples of ARM (automatic resource management) on the web for Scala. It seems to be a rite-of-passage to write one, though most look pretty much like one another. I did see a pretty cool example using continuations, though.
At any rate, a lot of that code has flaws of one type or another, so I figured it would be a good idea to have a reference here on Stack Overflow, where we can vote up the most correct and appropriate versions.
Daniel, good you asked this. I am myself intrigued after seeing James Iry's code. I see a gradual 4 step evolution for doing ARM in Scala:
What I would really love to see is a presentation describing these. It will be very educational and should convince the begots that there is a world beyond Monads :)