> On Sep 27, 2016, at 6:24 PM, Li Xiaolong <898310...@outlook.com> wrote:
> 
> > That’s not necessarily true — `await` in modules may be very different from 
> > this.
> 
> I don’t know what await in modules look like.

It’s still being discussed. I think there are some strong arguments for 
top-level “await”, which is the only case where you’re (currently) forced to be 
in a synchronous mode.

> 
> > You might be confused about something — if an awaited Promise is rejected, 
> > the async function can be resumed from a catch block to handle the 
> > rejection.
> 
> I know await can be catched. But the redundant reject state in promise makes 
> it more confusing.

What “redundant reject state”? What is redundant? And more importantly, how is 
it confusing? It maps to the same syntax of typical synchronous code, which is 
pretty clear about the error state vs non-error state.

> 
> > I’m not sure everyone shares this view — many people laud other languages 
> > where coroutines (for example) are indistinguishable from regular 
> > subroutines.
> 
> Well, when you are debugging and can’t find where the code waits, you’ll miss 
> the OMP.

That sounds like a puzzle for the DevTools team to solve :) There’s no reason 
the inspector couldn’t see this.

> 
> > How?
> I thought it again. Can I write: ‘await obj2.doSomeOtherThing(await 
> obj1.doSomeThing())’? If I can, then the await is not more complex than OMP 
> when dealing with deep async, just a little longer.

Yes, AwaitExpressions are just a form of UnaryExpression, and can be used 
anywhere a UnaryExpression is used (including as an operand to a function which 
is being `await`-ed.

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to