3 ms·
Why do you say Rust has exceptions? We have fail!(), which does roughly the same thing as Go's panic(). So much so that we decided to rename it to panic!().
by steveklabnik 12y ago
Why do you say Rust has exceptions? We have fail!(), which does roughly the same thing as Go's panic(). So much so that we decided to rename it to panic!().
- kyllo 12y agoYou're right. I must have misunderstood something I read.
- steveklabnik 12y agoCool :)
- kyllo 12y agoAhh, I remember what it was. I saw a code snippet like this: let input = reader.read_line().ok().expect("Failed to read line"); And I thought "Cool, Rust has exceptions!" I'm probably too used to thinking in Python. Or maybe I'm just dyslexic and I read "expect()" as "except()". Either way, your comment prompted me to dig into it further and find out how Rust actually handles errors. So, thanks!
- steveklabnik 12y agoThanks for elaborating! I wrote that line in the docs, actually. I wonder if I should add an explicit note about exceptions not being a thing.