Proposal: use "One More Point" to handle async functions

Caitlin Potter caitpotter88 at gmail.com
Tue Sep 27 15:33:09 UTC 2016


> On Sep 27, 2016, at 5:23 PM, Li Xiaolong <898310778 at outlook.com> wrote:
> 
> Sorry I’m not familiar with es7. But I still thing my OMP is better than async/await.
> 1: the await keyword can only be used in an async function, so each time you want to await you have to add async before outer function.

That’s not necessarily true — `await` in modules may be very different from this.

> 2: async/await still use promise to handle async, which is not as clear as my OMP that only use functions. The reject state of the promise became redundant since await never gets it.

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.

> 3: the async function calls identically with sync functions, makes it hard to check out if the function is async without jumping to the definition. But OMP can easily be recognized.

I’m not sure everyone shares this view — many people laud other languages where coroutines (for example) are indistinguishable from regular subroutines.

> 4: it’s complex for async/await to handle deep async callbacks.

How?

> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org <mailto:es-discuss at mozilla.org>
> https://mail.mozilla.org/listinfo/es-discuss <https://mail.mozilla.org/listinfo/es-discuss>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160927/597123a7/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160927/597123a7/attachment-0001.sig>


More information about the es-discuss mailing list