await on synchronous functions
Mark S. Miller
erights at google.com
Fri Jul 17 21:39:08 UTC 2015
On Fri, Jul 17, 2015 at 10:41 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> If I might, if there's one thing that has never particularly shone in JS,
> that is consistency.
> I see only two possibilities here: 1) it throws with non Promises 2) it
> "Promisify" anything that's not a Promise as if it was a
> `Promise.resolve(1)` ... but since there's too much magic in the second
> point, I'd rather stick with the first one.
Definitely #2. Had #1 been proposed, async/await never would have achieved
> Just my quick thoughts
> Best Regards
> On Fri, Jul 17, 2015 at 6:33 PM, Kevin Smith <zenparsing at gmail.com> wrote:
>> I know the spec for this isn't finalized, but what is the current
>>> direction for the behaviour when await is used on a function that is not
>>> marked async and doesn't return a Promise? Should it run immediately or
>>> wait for the next turn of the event loop?
>> More generally, the question is: what should await do for non-promises?
>> await 1;
>> Should it force a job to be queued?
>> es-discuss mailing list
>> es-discuss at mozilla.org
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss