<div dir="ltr">Actually using <span style="font-family:monospace,monospace">Promise.all</span> with async/await is usually code smell - you probably should await on values.<br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 26, 2016 at 10:40 AM, Damian Senn <span dir="ltr"><<a href="mailto:damian.senn@gmail.com" target="_blank">damian.senn@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I don't like the `await* []` syntax, it doesn't really tell me what it's doing.<br>I could imagine something like `await.all []` or `await.race []` desugaring to `await Promise.all([])` and `await Promise.race([])`, this could also be expanded to whatever new functionality might be added in the future (assuming await.something could work).<br></div><div class="HOEnZb"><div class="h5"><br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 26, 2016 at 10:37 AM kdex <<a href="mailto:kdex@kdex.de" target="_blank">kdex@kdex.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Personally, I wouldn't mind such an operator, as I feel that the use of `Promise.all` clearly<br class="m_4239460672036182757gmail_msg">
outweighs all other `Promise` combinators, but this could be an opinionated view.<br class="m_4239460672036182757gmail_msg">
<br class="m_4239460672036182757gmail_msg">
IIRC, that even was up for standards discussion at some point (being called `await*` instead<br class="m_4239460672036182757gmail_msg">
of `await`). I'm not sure what ever happened to that.<br class="m_4239460672036182757gmail_msg">
<br class="m_4239460672036182757gmail_msg">
On Wednesday, October 26, 2016 1:27:28 AM CEST Olivier Lalonde wrote:<br class="m_4239460672036182757gmail_msg">
> Right it makes sense, should have thought about that! An `awaitAll` (or<br class="m_4239460672036182757gmail_msg">
> other syntax) could be nice but it seems the general opinion is against.<br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
> On Wed, Oct 26, 2016 at 1:22 AM, kdex <<a href="mailto:kdex@kdex.de" class="m_4239460672036182757gmail_msg" target="_blank">kdex@kdex.de</a>> wrote:<br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
> > It's especially beneficial for designing APIs where you don't care about if<br class="m_4239460672036182757gmail_msg">
> > users pass you a `Promise` or the actual data to work with.<br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> > Imagine a scenario where you would like to remove a set of files:<br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> > ```js<br class="m_4239460672036182757gmail_msg">
> > async function remove(filesArray) {<br class="m_4239460672036182757gmail_msg">
> >         const files = await filesArray;<br class="m_4239460672036182757gmail_msg">
> >         /* … work with `files` here …*/<br class="m_4239460672036182757gmail_msg">
> > }<br class="m_4239460672036182757gmail_msg">
> > ```<br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> > In the scenario above, you could pass an array of files, or a `Promise`<br class="m_4239460672036182757gmail_msg">
> > that resolves<br class="m_4239460672036182757gmail_msg">
> > to said array; the function accepts both.<br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> > On Wednesday, October 26, 2016 1:03:37 AM CEST Olivier Lalonde wrote:<br class="m_4239460672036182757gmail_msg">
> > > I didn't realize `await` could be used on non-`Promise`s, never mind. I<br class="m_4239460672036182757gmail_msg">
> > > wonder why that is, seems strange. Maybe so that async functions could be<br class="m_4239460672036182757gmail_msg">
> > > more easily swapped out with sync ones in code? I do think `Promise.all`<br class="m_4239460672036182757gmail_msg">
> > > should deserve special treatment because it is so common, unlike<br class="m_4239460672036182757gmail_msg">
> > > Promise.race (who uses that seriously?) and future combinators. But I'm<br class="m_4239460672036182757gmail_msg">
> > not<br class="m_4239460672036182757gmail_msg">
> > > sure it is worth introducing new syntax for.<br class="m_4239460672036182757gmail_msg">
> > ><br class="m_4239460672036182757gmail_msg">
> > > On Wed, Oct 26, 2016 at 12:33 AM, Jordan Harband <<a href="mailto:ljharb@gmail.com" class="m_4239460672036182757gmail_msg" target="_blank">ljharb@gmail.com</a>><br class="m_4239460672036182757gmail_msg">
> > wrote:<br class="m_4239460672036182757gmail_msg">
> > ><br class="m_4239460672036182757gmail_msg">
> > > > Your suggestion would preclude having a promise for an array (exactly<br class="m_4239460672036182757gmail_msg">
> > what<br class="m_4239460672036182757gmail_msg">
> > > > `Promise.all` returns).<br class="m_4239460672036182757gmail_msg">
> > > ><br class="m_4239460672036182757gmail_msg">
> > > > If you want `await` syntax for `Promise.all`, you'd need different<br class="m_4239460672036182757gmail_msg">
> > syntax<br class="m_4239460672036182757gmail_msg">
> > > > for it - and then, what about `Promise.race`? What about other future<br class="m_4239460672036182757gmail_msg">
> > > > combinators?<br class="m_4239460672036182757gmail_msg">
> > > ><br class="m_4239460672036182757gmail_msg">
> > > > On Wed, Oct 26, 2016 at 12:25 AM, Olivier Lalonde <<a href="mailto:olalonde@gmail.com" class="m_4239460672036182757gmail_msg" target="_blank">olalonde@gmail.com</a>><br class="m_4239460672036182757gmail_msg">
> > > > wrote:<br class="m_4239460672036182757gmail_msg">
> > > ><br class="m_4239460672036182757gmail_msg">
> > > >> I don't think so, what do you mean?<br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >> On Wed, Oct 26, 2016 at 12:22 AM, Raul-Sebastian Mihăilă <<br class="m_4239460672036182757gmail_msg">
> > > >> <a href="mailto:raul.mihaila@gmail.com" class="m_4239460672036182757gmail_msg" target="_blank">raul.mihaila@gmail.com</a>> wrote:<br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >>> Then Promise.resolve([p1, p2]) should be like Promise.all([p1, p2]) ?<br class="m_4239460672036182757gmail_msg">
> > > >>><br class="m_4239460672036182757gmail_msg">
> > > >>> ______________________________<wbr>_________________<br class="m_4239460672036182757gmail_msg">
> > > >>> es-discuss mailing list<br class="m_4239460672036182757gmail_msg">
> > > >>> <a href="mailto:es-discuss@mozilla.org" class="m_4239460672036182757gmail_msg" target="_blank">es-discuss@mozilla.org</a><br class="m_4239460672036182757gmail_msg">
> > > >>> <a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" class="m_4239460672036182757gmail_msg" target="_blank">https://mail.mozilla.org/<wbr>listinfo/es-discuss</a><br class="m_4239460672036182757gmail_msg">
> > > >>><br class="m_4239460672036182757gmail_msg">
> > > >>><br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >> --<br class="m_4239460672036182757gmail_msg">
> > > >> - Oli<br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >> Oli Lalonde<br class="m_4239460672036182757gmail_msg">
> > > >> <a href="http://www.syskall.com" rel="noreferrer" class="m_4239460672036182757gmail_msg" target="_blank">http://www.syskall.com</a> <-- connect with me!<br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >> ______________________________<wbr>_________________<br class="m_4239460672036182757gmail_msg">
> > > >> es-discuss mailing list<br class="m_4239460672036182757gmail_msg">
> > > >> <a href="mailto:es-discuss@mozilla.org" class="m_4239460672036182757gmail_msg" target="_blank">es-discuss@mozilla.org</a><br class="m_4239460672036182757gmail_msg">
> > > >> <a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" class="m_4239460672036182757gmail_msg" target="_blank">https://mail.mozilla.org/<wbr>listinfo/es-discuss</a><br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > >><br class="m_4239460672036182757gmail_msg">
> > > ><br class="m_4239460672036182757gmail_msg">
> > ><br class="m_4239460672036182757gmail_msg">
> > ><br class="m_4239460672036182757gmail_msg">
> > ><br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
> > ______________________________<wbr>_________________<br class="m_4239460672036182757gmail_msg">
> > es-discuss mailing list<br class="m_4239460672036182757gmail_msg">
> > <a href="mailto:es-discuss@mozilla.org" class="m_4239460672036182757gmail_msg" target="_blank">es-discuss@mozilla.org</a><br class="m_4239460672036182757gmail_msg">
> > <a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" class="m_4239460672036182757gmail_msg" target="_blank">https://mail.mozilla.org/<wbr>listinfo/es-discuss</a><br class="m_4239460672036182757gmail_msg">
> ><br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
><br class="m_4239460672036182757gmail_msg">
<br class="m_4239460672036182757gmail_msg">
<br class="m_4239460672036182757gmail_msg">
______________________________<wbr>_________________<br class="m_4239460672036182757gmail_msg">
es-discuss mailing list<br class="m_4239460672036182757gmail_msg">
<a href="mailto:es-discuss@mozilla.org" class="m_4239460672036182757gmail_msg" target="_blank">es-discuss@mozilla.org</a><br class="m_4239460672036182757gmail_msg">
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" class="m_4239460672036182757gmail_msg" target="_blank">https://mail.mozilla.org/<wbr>listinfo/es-discuss</a><br class="m_4239460672036182757gmail_msg">
</blockquote></div>
</div></div><br>______________________________<wbr>_________________<br>
es-discuss mailing list<br>
<a href="mailto:es-discuss@mozilla.org">es-discuss@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" target="_blank">https://mail.mozilla.org/<wbr>listinfo/es-discuss</a><br>
<br></blockquote></div><br></div>