Settings

Theme

Show HN: Async/await alternative

github.com

17 points by bruno2223 9 years ago · 9 comments

Reader

vsviridov 9 years ago

Node 7 is out with async/await behind the flag.

zamalek 9 years ago

    // the stream has now been fully read, async in the background
What if the file is gigabytes in size?
  • bruno2223OP 9 years ago

    Then you simply do not use this module :-)

    Unless you have Time and RAM to waste.

skybrian 9 years ago

It's a nice trick but it's unsafe in general. JavaScript libraries usually assume single-threaded event handling. If you start up another event loop from a callback (while some other library's code is already on the stack), you'll probably break it.

maxpert 9 years ago

Well I hope NodeJS ultimately settles on such a syntax to preempt and resume automatically. I love Golang in this regard since it abstracts out everything using channels, and go-routines (not to compare multiple thread support).

aaronhoffman 9 years ago

Love the simplicity. Wish it was powered by RxJS https://github.com/Reactive-Extensions/RxJS

bbcbasic 9 years ago

Looked at the deasync that this is based on, and it looks like they are trying to reinvent threads? Seems ironic to me.

  • jjnoakes 9 years ago

    Why do you think they are trying to reinvent threads? Looks to me like it is a basic nested event loop.

    • bbcbasic 9 years ago

      It pauses execution of a stack when it is blocked allowing other stacks to execute.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection