I think the ergonomics of generators is growing on me.
May 19, 2025

To be fair, I have found them handy at least once. I’ve written about using them for destructuring an arbitrary number of items on demand. I still love that use case, but I do wonder if there’s something more I’m missing out on.
So, I wanted to give them an honest, intentional shake. Maybe after getting a better feel for them, opportunities would pop up. To my surprise, I think I’ve begun to appreciate both the ergonomics they offer and the mental model they encourage, at least in certain scenarios. I’ll try to unwrap where I’m at. First, let’s step back and flesh things out a bit.
Source: I think the ergonomics of generators is growing on me. | Alex MacArthur
We’ve had a number of talks on iterators and generators on Conffab, but my instinct is they’re still not widely used. This excellent introduction might help change that.