Hacker News new | ask | show | jobs
by edflsafoiewq 2078 days 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)
  }
1 comments

This 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.