`await null` to stay in the same tick?

Logan Smyth loganfsmyth at gmail.com
Tue Feb 9 03:30:02 UTC 2016


Joe, if you have a specific example, feel free to file an issue and I can
take a look. From what I can see,
http://babeljs.io/repl/#?experimental=true&evaluate=true&loose=false&spec=false&playground=false&code=%0A%0A(async%20function%20fn()%7B%0A%20%20console.log('start')%0A%20%20Promise.resolve().then(()%20%3D%3E%20console.log('tick'))%3B%0A%20%20await%20null%3B%0A%20%20%0A%20%20console.log('end')%3B%0A%7D)()%3B
would indicate that Babel always defers with Regenerator as well. Better to
have this discussion elsewhere though.

On Mon, Feb 8, 2016 at 7:07 PM, /#!/JoePea <joe at trusktr.io> wrote:

> (Or, maybe it's Facebook Regenerator's fault, not Babel's)
>
>
> On Monday, February 8, 2016, /#!/JoePea <joe at trusktr.io> wrote:
>
>> Aah, good to know. With Babel this isn't the case, as `await null`
>> doesn't defer, so I was doing `await somethingThatMightBeNull` to possibly
>> defer, but `if (somethingThatMightBeNull) await somethingThatMightBeNull`
>> will be full proof if Babel fixes that.
>>
>> On Sunday, February 7, 2016, Mark S. Miller <erights at google.com> wrote:
>>
>>>
>>>
>>> On Sun, Feb 7, 2016 at 1:51 PM, Kris Kowal <kris.kowal at cixar.com> wrote:
>>>
>>>> Await yields to the event loop unconditionally. This is useful for
>>>> spreading CPU-bound work across multiple events. You can explicitly await
>>>> conditionally.
>>>>
>>>> ```
>>>> if (guard) { await guard; }
>>>> ```
>>>>
>>>
>>> Good example, thanks.
>>>
>>>
>>>
>>>>
>>>> On Sun, Feb 7, 2016 at 1:39 PM /#!/JoePea <joe at trusktr.io> wrote:
>>>>
>>>>> I'm not sure where's the best place to ask, but if I
>>>>>
>>>>> ```
>>>>> await null
>>>>> ```
>>>>>
>>>>> in an async function does that guarantee that the following code will
>>>>> execute immediately (control flow will not go anywhere else)?
>>>>>
>>>>> - Joe
>>>>> _______________________________________________
>>>>> 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
>>>
>>
>>
>> --
>> /#!/JoePea
>>
>
>
> --
> /#!/JoePea
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160208/d97e572b/attachment-0001.html>


More information about the es-discuss mailing list