News for hackers. Stuff that matters.
Re:My Struggles with Rust by MichaelGG on Sunday May 07, 2017 @02:10PM (#14286653)
>An application error (returned null) shouldn't abort your application with a hard error, no logs. Its just plain poor practice to use unwrap().

What? That's what every other language does.

  file.open("foo").read_line()
If open fails it'll either throw or return null which will then cause read_line to throw a null pointer exception. Rust just makes things explicit here.

Though it might be interesting if there was a special opt-in Deref impl for Result and Option so people could omit the unwrap and just get it implicitly, for the occasions when you don't want that explicitness.

There are no comments on this comment yet.