2 ms·
True, though in some cases you may want to write that one as: foo().and_then(bar).and_then(baz) That becomes a bit more verbose, but it reads left-to-righ
by JoshTriplett 10y ago
True, though in some cases you may want to write that one as:
foo().and_then(bar).and_then(baz)
That becomes a bit more verbose, but it reads left-to-right, and works better if you want to use a closure as one of the functions. Which form looks more readable in a given circumstance may depend on the nature of foo, bar, and baz.
- masklinn 10y agoIt has somewhat different semantics though, for instance with `?` all three functions can use different error types.
- richardwhiuk 10y agoThey have to be convertable though, because the function must have a single result code.