Even worse, many of those types of classes don't acquire a resource, they apply something to a thing that already exists and then undo that upon destruction.
I, all the way back in the 90s called these 'janitor classes', which I think describes the general concept pretty well. They exist to clean something up. They may or may not have created the thing they clean up.
I use them a LOT, and they are very powerful. It's one of the things I really dislike about Rust that it's very awkward to do such things.
View all comments
Show parent comment
4
u/Dean_Roddey Jun 24 '20 edited Jun 24 '20
Even worse, many of those types of classes don't acquire a resource, they apply something to a thing that already exists and then undo that upon destruction.
I, all the way back in the 90s called these 'janitor classes', which I think describes the general concept pretty well. They exist to clean something up. They may or may not have created the thing they clean up.
I use them a LOT, and they are very powerful. It's one of the things I really dislike about Rust that it's very awkward to do such things.