-
Notifications
You must be signed in to change notification settings - Fork 583
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
Conversation
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. |
To much Go lately ;-)
I actually wanted to show how the get could be implemented by using a
promise, to have a useful example of asynchronous operation that takes some
time to complete.
Maybe I should add that get_p does what the example shows.
2018-04-13 23:43 GMT+02:00 Dan Book <[email protected]>:
… 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.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1211 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AACqnmfK8dBbfWZmOEB1mbF5yODkOEhcks5toRwKgaJpZM4TUgNm>
.
|
lib/Mojo/Promise.pm
Outdated
my $both = Mojo::Promise->all($promise1, $promise2)->then(sub { | ||
my ($value1, $value2) = @_; | ||
println "Mojolicous website returns " . $value1; | ||
println "Perlbrew website returns " . $valuu2; |
There was a problem hiding this comment.
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
I think that our basic example should not not reimplement get_p. |
Thanks for the feedback!
The basic example was taken from the synopsis, but maybe is not the best
way based on your feedback. I'd like to have something people will
associated with a longer running task (web request, brew beer, background
job, long calculation) and then do the all example to actually put the
promise code to use.
Ideas welcome, on what a basic example could do...
2018-04-14 10:45 GMT+02:00 Marcus Ramberg <[email protected]>:
… I think that our basic example should not not reimplement get_p.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1211 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AACqngW1z1n0i7OfvkVvkW-Z37SoOLvfks5tobcngaJpZM4TUgNm>
.
|
Looks like this pull request went stale. |
Sorry, yes I ran out of time to spare.
But I'm still supporting this PR, but will need some more time (approx 3
weeks)
BR Roland
2018-04-27 10:11 GMT+02:00 Sebastian Riedel <[email protected]>:
… Looks like this pull request went stale.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1211 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AACqnm8chBKAxhg3GPt8hRn0UcM3OMyPks5tstLFgaJpZM4TUgNm>
.
|
Understood, please open a new pull request when you are ready. |
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