Skip to content

Instantly share code, notes, and snippets.

@bmeck
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save bmeck/032dcb9d68bcedb6203b to your computer and use it in GitHub Desktop.

Select an option

Save bmeck/032dcb9d68bcedb6203b to your computer and use it in GitHub Desktop.
Notes on Async Call Bradley Meck and Alex Rauchmayer

Discussion around Bradley

Async functions

Generally good, a bit odd that it is limited to promises, see http://www.2ality.com/2015/03/no-promises.html and https://www.npmjs.com/package/generator-runner

Concerns:

  • Sometimes no need to invoke promise task queue (async fn calling async fn etc.)
  • lack of abort, generators have .return (not in v8 yet) that runners can use (compiled output contains .return)
  • scope nesting if new promises used in a loop/recursively (only applies to compiled output?)
    • would need more data / VM implementation

Pros (do not underestimate how valuable these are):

  • try/finally work
  • loops work
  • explicit syntax when code can be stopped

Async Generators

https://github.com/jhusain/asyncgenerator

Concerns:

  • Back Pressure
  • Abort, like above
    • more complex, can be in a state of an await wanting an abort but need error recovery

Pros:

  • Can queue data to push to async work

Alex mentioned:

CSP as alternative perspective on Async Generators

  • Creates channels
  • Limited capacity

http://jlongster.com/Taming-the-Asynchronous-Beast-with-CSP-in-JavaScript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment