4 ms·
I believe await uses generators instead of CPS
by nialv7 10y ago
I believe await uses generators instead of CPS
- barrkel 10y agoGenerators are implemented with continuations, just like C#'s iterators (yield return statement). In C#'s case, it rewrites the function into a continuation via a state machine, but it's just using an integer to point at the remainder of the function, just like an index into an array isn't very different to a pointer - it's a distinction without much of a difference. (JS VMs are free to implement generators however they like, of course.)