-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Right now
docs.scala-lang/_overviews/core/futures.md
Line 628 in 6ef51ab
| The `recoverWith` combinator creates a new future which holds the |
recover and recoverWith:
The
recovercombinator creates a new future which holds the same result as the original future if it completed successfully
vs
The
recoverWithcombinator creates a new future which holds the same result as the original future if it completed successfully
which is rather confusing to beginners.
The first real differentiation appears in the middle of the paragraphs:
If it maps the
Throwableto some value, then the new future is successfully completed with that value.
vs
If it maps the Throwable to some future, then this future is completed with the result of that future.
which took me a while to find and I personally struggled to parse because I couldn't tell if there is a typo somewhere of text is precisely correct and needs to be interpreted as such.
Assuming the text is correct, perhaps it would help if the first sentence of the second paragraph would say something like:
The
recoverWithcombinator also creates a new future which ...
and later on in the same paragraph, something like
If it maps the
Throwableto some future, then, unlike what happens withrecover, this future is completed with the result of that future.
Or perhaps someone can come up with a much more clear wording than I can :) https://stackoverflow.com/a/36585703/1517753 ?
Thank you for this documentation!