11 ms·
> It's one character. No it isn't. With exceptions: fn foo() -> i32 { let x = bar(); x + 1 } vs fn foo() -> Result<i32, SomeErrorType> { l
by edflsafoiewq 6y ago
> It's one character.
No it isn't. With exceptions:
fn foo() -> i32 {
let x = bar();
x + 1
}
vs
fn foo() -> Result<i32, SomeErrorType> {
let x = bar()?;
Ok(x + 1)
}
- steveklabnik 6y agoThis is fair, thank you for the correction. I do think it's not quite what you're saying though, due to Rust's design, we would have checked exceptions, and so the Result part would be there with exceptions, it's the Ok() part that would change. In theory you could make a language without checked exceptions that would make it be like your example.