How about awaiting Arrays ?

Mark S. Miller erights at google.com
Fri Mar 3 20:29:39 UTC 2017


On Fri, Mar 3, 2017 at 12:27 PM, Mark S. Miller <erights at google.com> wrote:

>
>
> On Fri, Mar 3, 2017 at 8:51 AM, Michał Wadas <michalwadas at gmail.com>
> wrote:
>
>> Actually I would go with
>>
>> await ...expr;
>>
>
> I have not liked any of the prior suggestions on this thread. But this one
> is interesting. It has no compatibility problems, it composes nicely, and
> it suggests its meaning clearly.
>

I should have read ahead. await.all and await.race also have these virtues,
and there's no generalization of await ...expr that naturally expresses
race.



>
>
>
>>
>> As sugar for:
>>
>> await Promise.all(Array.from(expr))
>>
>>
>> On 3 Mar 2017 17:15, "T.J. Crowder" <tj.crowder at farsightsoftware.com>
>> wrote:
>>
>> On Fri, Mar 3, 2017 at 3:28 PM, Matthew Robb <matthewwrobb at gmail.com>
>> wrote:
>> >
>> > I think this conversation needs to happen but I am not sure baking
>> > it into Array facilities makes the most sense.
>> >
>> > In my experience with async/await I am very often needing Promise.all
>> but
>> > in some cases the other forms of multi promise capabilities. What if we
>> > expanded the keyword `await.all [...]; await.race [...]`
>>
>> Heh, I was thinking of that too, as an alternative to the `awaitall`
>> and such I suggested to Andrea so we didn't need to add Yet More
>> Keywords. :-)
>>
>> ```js
>> await.all iterable;
>> ```
>>
>> instead of
>>
>> ```js
>> await Promise.all(iterable);
>> ```
>>
>> ? That seems pretty clear to me, and doesn't seem like a big
>> specification or implementation burden (he said, talking through his
>> hat).
>>
>> -- T.J.
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
>
> --
>     Cheers,
>     --MarkM
>



-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170303/a74ae3b7/attachment.html>


More information about the es-discuss mailing list