Kind of with Rust had a notion of `impl TryDrop` for running destructors that can be unsuccessful. Could handle errors gracefully in Result contexts. Call `.unwrap()` in other contexts. Manually dropping through `try_drop(my_fn())?;`
Right. But it's not a no-op for Mutexes, DB connections, files, etc. right? That's more the angle I'm thinking about. Would there be a way to handle errors in destructors there, but don't force API consumers to remember to copy boilerplate.
-
-
Lol, "right" twice in a sentence. Plane is about to take off, and I'm definitely feeling groggy haha.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
> But it's not a no-op for Mutexes, DB connections, files, etc. right? No, i mean the drop() function isn't special. It's written as a no op, it works by letting the value fall out of scope. https://doc.rust-lang.org/beta/src/core/mem.rs.html#770 …
-
Ahahaha, okay that's pretty cool. I thought there had to be more to it, but that's really clever!
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.