Looks promising ;-)
I mostly work with Futures in Scala, which is working extremely well,
especially with the for comprehensions which actually make asynchronous
code look like sequential calls. See
http://docs.scala-lang.org/sips/completed/futures-promises.html for details.
For those interested here's an example (sorry for actually using scala
syntax here):
def getGroupForUser(username: String) = Future[Group]
for {
user <- repo.getUserByName(username) # returns a Future[User]
group <- repo.getGroupForUserId(user.id) # using the id of the
retrieved user object (which is now flattened to User (no Future)
} yield (group) # return a Future[Group] now
A implementation for Future is already on CPAN:
https://metacpan.org/pod/Future
So enough off-topic stuff, we are missing the relation to Mojolicious a
litte. Although an event-loop less pure async implementation of Mojolicious
would be interesting, it sure requires support for thread pooling. So we
have to look forward to perl6 anyway. But that's just around the corner for
christman (but this year we mean it!).
Cheers
+rl
On Wed, Feb 11, 2015 at 10:39 PM, [email protected] <[email protected]> wrote:
> Hi mojo people. I've started Promises with DSL syntax. How do you find
> this experiment?
>
> https://github.com/alexbyk/perl-promises6#promises6
>
> promise {
> my ($resolve, $reject, $progress) = @_;
> $resolve->(promise_me(5));
>
> then sub($v) { say "fulfilled: $v" };
>
> when_progress { say "progress $_[0]" };
> when_rejected { say "rejected $_[0]" };
>
> then sub { }, sub { }, sub { };
>
> when_ok {
> my $val = shift;
> print "Fulfilled with $val";
> };
>
> };
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.