News for hackers. Stuff that matters.
Re:Things Go needs more than generics by mathw on Monday October 04, 2021 @06:19AM (#28744991)
It is a shame there are so many Rust examples out there with unwrap() all over them, because it's really not something I would want to see in production code. expect() with a message if you know that the only reason this fails is because something else messed up that should have prevented the call in the first place, sure. unwrap()? No thanks. That's why we have the ? operator now.
Re:Things Go needs more than generics by da39a3ee on Monday October 04, 2021 @08:57AM (#28746070)
Agreed, except I don't think people should use expect() since its name is a mistake made early on in Rust: people use it to write

expect("something bad we don't expect")

unwrap_or_else(|| panic!(...))

is clear and doesn't suffer from the naming mistake.