Skip to content

Futures documentation missing Success/Failure import #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jackdempsey opened this issue Dec 20, 2013 · 4 comments
Closed

Futures documentation missing Success/Failure import #278

jackdempsey opened this issue Dec 20, 2013 · 4 comments

Comments

@jackdempsey
Copy link
Contributor

I was working through the great documentation on futures and came across a basic issue:

:13: error: not found: value Success
f onComplete { case Success(x) => println(x); case Failure(e) => println(s"failed: $e") }

After some googling it seems a refactor moved those values to a different location. Adding this import fixes things:

scala> import scala.util.{Success, Failure}

I started to add this to the markdown docs for a pull request, but wanted to see if just adding it to the top where the other imports are mentioned is best or if someone more familiar with this change and the docs has a better suggestion?

@heathermiller
Copy link
Member

Thanks a lot -- indeed a valuable suggestion! A PR with your suggestions would be very welcome :)

I suppose it's a matter of opinion. Personally, it'd make the most sense to me to have it at the top where the other imports are mentioned as well as in places with more complete code examples (e.g., code examples with other imports as well). Though in skimming through the docs real quick, I actually don't see a place where we directly match on Success. Instead, I see that we use onSuccess heavily, which wouldn't require importing Success or Failure.

@jackdempsey
Copy link
Contributor Author

Sure, I opened a PR here: #279

The line I mentioned above f onComplete { case Success... is a direct match, right? That's where it busted and then worked again after specific import.

I kept the import right next to the code using Success just in case people look at it specifically and try to run in console. Hope this helps!

@heathermiller
Copy link
Member

Yep, you're totally right. I completely missed that code snippet. Good point, and thanks a lot for the PR! It's been merged :)

@jackdempsey
Copy link
Contributor Author

That's got to be the fastest merge ever - I clicked send about 30 seconds
ago :-) thx!

On Sat, Dec 21, 2013 at 4:04 PM, Heather Miller [email protected]:

Yep, you're totally right. I completely missed that code snippet. Good
point, and thanks a lot for the PR! It's been merged :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/278#issuecomment-31075490
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants