Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Koa2 #16

wants to merge 4 commits into from

Conversation

omsmith
Copy link
Contributor

@omsmith omsmith commented Nov 18, 2015

No description provided.

@tj
Copy link
Member

tj commented Nov 19, 2015

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

@omsmith
Copy link
Contributor Author

omsmith commented Nov 19, 2015

We could compile ahead of time, but then we're just back to generators (and we may as well just co.wrap all of these.).

Don't think this is too large of an effort.

@tj
Copy link
Member

tj commented Nov 19, 2015

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

@fengmk2
Copy link
Member

fengmk2 commented Nov 20, 2015

It's back to callback style.

Can we make to change to next branch?
If user want to use, publish a new major version like 3.0.0-alpha.1?

I maintaining a lot of koa@1 applications inside and they're hard to upgrade to koa@2.
I don't think this is the time to use koa@2 ready for most people.

@haoxins haoxins mentioned this pull request Nov 20, 2015
@tejasmanohar
Copy link
Member

@omsmith -

We could compile ahead of time, but then we're just back to generators (and we may as well just co.wrap all of these.).

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" ;)

@omsmith
Copy link
Contributor Author

omsmith commented Nov 20, 2015

@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

@omsmith
Copy link
Contributor Author

omsmith commented Nov 20, 2015

s/implemented/polyfilled

@tejasmanohar
Copy link
Member

@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.

@tejasmanohar tejasmanohar mentioned this pull request Nov 20, 2015
@omsmith
Copy link
Contributor Author

omsmith commented Nov 20, 2015

I added a commit that hoists the functions out, just to play with it

@jonathanong
Copy link
Member

@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.

@jonathanong
Copy link
Member

@omsmith
Copy link
Contributor Author

omsmith commented Feb 27, 2016

Hmm, you're quite right - usually notice that. Thanks ;)

@jonathanong
Copy link
Member

oops it's really this branch https://github.com/koajs/etag/tree/v3.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants