Meneus: You’re never actually leaving promise-land, async/await is just a way to pretend like you are
Leverson: Meneus, but what await yields can be any thenable, or not?
Kerbel: Hendershott: https://nodejs.org/en/blog/release/v4.0.0/
Bohac: Does not now track v8’s version number?
Hobson: But like 2 weeks ago I read somthing that said io.js wasn’t going to be fully? merged until next april or somehting
Bohac: S/does not/does node/ even
Kerbel: Cut off? hrm it’s pretty short, showed likei t made it through here
Kerbel: Http://pastie.org/10406132
Kerbel: I thought you could do something like this
Leverson: Kerbel, oh!, yeah, I don’t think so
Kerbel: But lets say I wrap this entire thing in an “async iife”, even that would be no good?
Leverson: Await is basically a yield inside a generator
Leverson: Async creates a generator that eventually returns a promise
Meneus: Kerbel: yeah, that wouldn’t work
Leverson: Kerbel, if you wrap it it should be good, yeah
Poltorak: Sooooo, sounds like they merged it all
Meneus: As Leverson said, async/await is just more sugar for a spawn function/coroutine
Meneus: Leverson: I believe it will work with any thenable, yes
Kobis: Hendershott, there are some practical issues still left, like all native addons have to updated to compile with never V8 API
Imig: I actually like that, weeds out unmaintained stuff
Kerbel: Http://bit.ly/1KCP8SE
Kerbel: So why not just default the global scope to “async”?
Leverson: Kerbel, because everything would have to be technically inside a generator.
Meneus: Right, it’s smoke and mirrors
Meneus: If you did that, you’d basically be tellign the event loop not to do anything until the promise in question is resolved
Meneus: IE you’d be making it sync for real
Kerbel: Alright. I still don’t really get the underlying bits but I will one day
Kerbel: Now what about .catch
Kerbel: How does that fit into await
Kerbel: If I reject where does it go
Meneus: Well, basically you get to use try/catch again
Meneus: Though because of the chainability of promises you could await yourPromise.catchhandleIt to catch any general errors, to keep the number of try/catch blocks to a minimum
Leverson: Try.catch basically calls throw on the generator
Leverson: And bubbles the error
Leverson: Async/await is similar to Haskell’s do notation
Meneus: It can turn into a huge mess though if you just let it bubble not unlike with long promise chains
Kerbel: In my babel test it just printed to console
Leverson: In fact, async/await could be made more general to make it work with other monads, not just Promise
Kerbel: Not sure if that’s a babel thing or chrome doing that tho
Leverson: Do function {var a = draw m}
Meneus: Well that’s kinda what async generators will do
Leverson: Something like that for example
Meneus: Async generators will be able to work with, and yield, Observables
Meneus: At least, last time I looked at the spec that’s what they’d do
Meneus: Dunno if babel has implemented those yet though
Kerbel: Meneus: http://bit.ly/1Nopku1
Kerbel: Seems like it still executes in the same order expected, I don’t understand what you meant by “nothing would happen until promise resolves”