yield and Promises
John J Barton
johnjbarton at johnjbarton.com
Fri Oct 21 13:49:50 PDT 2011
On Fri, Oct 21, 2011 at 10:46 AM, Mark S. Miller <erights at google.com> wrote:
> On Fri, Oct 21, 2011 at 10:20 AM, John J Barton <
> johnjbarton at johnjbarton.com> wrote:
>> In particular, Q simplifies joining parallel async operations (XHR,
>> postMessages, 'load', 'progress' events). Of course it may well be that
>> generators provide an elegant solution to this important problem, but I've
>> not seen such examples.
> Have you seen
> http://wiki.ecmascript.org/doku.php?id=strawman:concurrency#q.race and
> http://wiki.ecmascript.org/doku.php?id=strawman:concurrency#q.all ? If
> these don't address the joining you have in mind, could you post some
> examples? Thanks.
Unfortunately I was not able to follow the comments on that page. (These
strawman pages are hard to follow because they describe new things using new
This code seems to do what I intended:
The structure is: start A, start B, when A&B (start C, start D, when C&D (we
The code marches right but for me the key is being able to predict the
relative order of the calls.
Of course this particular example is not good for comparing different
alternatives. I guess the biggest win for Q comes in unconventional cases
where async is used for remote communications and such examples are
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss