Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Are generators still relevant as a performance / concurrently tool, in presence of async support? Or what's the point of Koa's alleged heavy use of generators?



Async generators are a feature built into the language because generators and async/await solve orthogonal problems.

That said, I also honestly don't know what specifically we're talking about here—I've used Koa on a few small projects and never used a generator for it. I landed on it because it has first-class support for async. Maybe there are generators used under the hood?

I didn't bother questioning the generators in the first post not because I knew what they were referring to but because the main thrust to my question remains either way: what's the new technical foundation that Koa is supposedly lacking, and why must every JS framework use the latest hotness?

Koa supports async and otherwise feels very much like express. That has been plenty good for me.

Edit: Google turns up no references to generators whatsoever on the koajs.com pages, so I'm not at all sure what OP was talking about. But again—I'm less concerned about whether they got the details of the implementation correct than I am about the idea that JS frameworks need to be swapped out constantly to stay relevant.

https://www.google.com/search?q=site%3Akoajs.com+generators


I can't find the blog post now, but I remember reading about how Koa's event loop was built around JS generators and that was big thing then, that's why I mention it. I haven't used Koa so maybe I'm misunderstanding something.

I did find this video that covers an early version of Koa. https://youtu.be/RVxx2T7SPw8

> An introduction to the Koa web framework for Node.js and some of the technologies behind it. Covers ES6 generators, promises and TJ Hollowaychuk's Co library.


Thanks!

WRT frameworks, I think that good frameworks have a staying power: see Spring Boot, Django, Rails, and, well, Express.

When a language evolves as quickly as JS/TS has been past 10 years, fundamentally better ways to do things spring up relatively often. They may be adopted by existing frameworks, or give rise to completely new, legacy-free ones. Sadly, the "legacy-free" tag very often comes with the "nor battle-tested, here be dragons" tag.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: