Skip to content
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

refs #1172: Add short introduction to promises #1211

Closed
wants to merge 2 commits into from

Conversation

lammel
Copy link
Contributor

@lammel lammel commented Apr 13, 2018

Summary

This PR aims to improve the documentation of Mojo::Promise with a short introduction into the subject. Only documentation is added, no code changes.

The println in the examples should be replaced with something more useful, but should be ok for discussion for now.

Motivation

Improve docs for beginners and newcomers that may find promises and their composability useful.

References

Should close #1172

@Grinnz
Copy link
Contributor

Grinnz commented Apr 13, 2018

println doesn't exist in perl, the function is called say. There's a get_p method in Mojo::UserAgent that you can use for the promise-returning function examples.

@lammel
Copy link
Contributor Author

lammel commented Apr 13, 2018 via email

my $both = Mojo::Promise->all($promise1, $promise2)->then(sub {
my ($value1, $value2) = @_;
println "Mojolicous website returns " . $value1;
println "Perlbrew website returns " . $valuu2;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/valuu2/value2/ in addition to say instead of println as mentioned

@marcusramberg
Copy link
Member

I think that our basic example should not not reimplement get_p.

@lammel
Copy link
Contributor Author

lammel commented Apr 14, 2018 via email

@kraih
Copy link
Member

kraih commented Apr 27, 2018

Looks like this pull request went stale.

@lammel
Copy link
Contributor Author

lammel commented Apr 28, 2018 via email

@kraih
Copy link
Member

kraih commented Apr 28, 2018

Understood, please open a new pull request when you are ready.

@kraih kraih closed this Apr 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Small introduction to promises
4 participants