3 ms·
> a caveat should follow advice like using unwrap and expect, perhaps a small blurb about how they should eschewed for better error handling when you want to ca
by shadowmint 9y ago
> a caveat should follow advice like using unwrap and expect, perhaps a small blurb about how they should eschewed for better error handling when you want to catch the errors and make decisions because of them.
That is literally the definition of hypocrisy; the behavior of people who do things that they tell other people not to do.
"When you do this, do it like this, but properly with error handling." :P
Anyhow, as I said its my oppinion that unwrap() is lazy, and `?`, `expect` and `assert!` cover the same functionality in more explicit and meaningful way.
You're welcome to your own opinion.
- jjnoakes 9y ago> That is literally the definition of hypocrisy; the behavior of people who do things that they tell other people not to do Except I'm not saying that at all. I said it's fine to use unwrap() or expect() if you want script-like default behavior (a developer-centric error message and a quick exit with a bad return code) and if you want something more than that, then use something better than unwrap() or expect(). There's no hypocrisy here. I think anyone should follow that advice. Me, you, a newb to Rust, a Rust veteran, anyone. Same advice.