Comment

Comment by kevincox

I know GAT is a "bigger feature" for the language but personally I'm most excited about `let else`. It is very common to write code such as:

  let foo = match do_something() {
    Ok(f) => f,
    Err(e) => {
      // Do some error handling, maybe log a warning, maybe skip this item and continue...
    }
  };
This small change makes that so much more clear, removes the silly first row and removes a level of indentation.

  let Ok(foo) = do_something() else {
    // Do some error handling, maybe log a warning, maybe skip this item and continue...
  };
parent kevincox 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton