Why? Not all destructors are equal. Similar to how not all conversions are equal. I think there's lots of value to be had to be able to find a middle ground between "panic" and "ignore" when a destructor is fallible.
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())?;`
-
-
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Could you expand on how this would work? Destructors are called automatically -- there's no way to "try" them.
-
My understanding is that when `drop(foo)` is called, the destructor is run. This can be done manually, or more commonly it happens automatically when the value goes out of scope. `try_drop(foo)?` would be the manual, fallible equivalent. But provides a Result escape hatch
- 3 more replies
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.