Comment

Comment by overthrow

> BUT when you try to use it with iterators -- which are also amazing, I love using iterators -- IT DOESNT WORK.

Yes it does

  let res: Result<Vec<_>, _> = iterator.iter().map(|x| x.foo()).collect();
  let res = res?;
> But this also happens elsewhere, because of this ugly inflexability, we cant do:

Use and_then:

  let z = x.foo().and_then(|y| y.bar())?;
I get that there's an upfront cost to learning this stuff, but I think he's blaming the language a little too aggressively.
parent overthrow 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton