-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Koa2 #16
Koa2 #16
Conversation
woot 👍 I almost wonder if we should wait for async/await to upgrade middleware, since everyone will probably want to convert them to that after anyway and it's a more direct translation |
We could compile ahead of time, but then we're just back to generators (and we may as well just Don't think this is too large of an effort. |
To me 2.0 is useless until async/await is native, transpiling on the server is just weird if you really don't have to, or at least have a compelling reason to |
It's back to callback style. Can we make to change to next branch? I maintaining a lot of koa@1 applications inside and they're hard to upgrade to koa@2. |
@omsmith -
I def disagree. Co's built in generator hacky-ness, attempting to fake coroutines with generators (a synchronous feature), and using this for promise-based control flow is meh. Async/await is an actual language feature and is merely a Promise then() handler so there's a huge advantage... it's not at all "back to generators" ;) |
@tejasmanohar I was referring to if we were to use Babel to write these middleware with async/await and publish compiled code, it would be implemented with generators, just as is used today |
s/implemented/polyfilled |
@omsmith Depends on the settings used. IIRC, Babel can transpile async functions into fake coroutines like Co or promise-handling ES5- just depends on the options / presets chosen in v6. |
I added a commit that hoists the functions out, just to play with it |
@omsmith there's a lot of style changes here that mess everything up. ex. you have mixed spaces and tabs. please try to avoid doing that next time, but i'll fix it myself this time. |
Hmm, you're quite right - usually notice that. Thanks ;) |
oops it's really this branch https://github.com/koajs/etag/tree/v3.x |
No description provided.