|
On 12/06/2019 19.33, Coda Highland wrote:
On Wed, Jun 12, 2019 at 12:28 PM Andrew Gierth <andrew@tao11.riddles.org.uk <mailto:andrew@tao11.riddles.org.uk>> wrote:Egor suggested <resource>. I think Sean Connor's <cleanup> is better, but to throw out some other random ideas: <unwind> or <onexit>.-- Andrew.+1 to <onexit>. I think I might like it better than <scoped>.
I think <onexit> will be confusing: It's not run when you exit the program but when you leave the current scope.
<cleanup> and <unwind> aren't bad.
<cleanup>, <unwind>, <scoped> would all be fine for me, with <unwind>/<scoped> slightly preferred – these two describe the mechanism / when stuff happens, not what happens.
"cleanup" is both slightly too wide (not all cleanup happens in <close>) and slightly too narrow (not everything you might do in <close> is strictly cleanup, you might also be generating a report / doing stats / …).
<close> is about as good as <cleanup> – acceptable but feels somewhat imprecise.
-- nobody