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

Yup this is a great article about it that I coincidentally re-read yesterday:

https://journal.stuffwithstuff.com/2013/01/13/iteration-insi...

I find it easier to think of as "push-pull" though. In Python and Go, you "pull" from iterators. In Ruby, JavaScript, and Rust, you're "pushed" upon. You can do both styles in any language, but there's one way that's favored.

To break the dilemma, you need 2 call stacks, which means threads / coroutines / generators.

(There was a recent blog post about writing an iterator to do the powerset calculation, which is a bit tricky, and made me think of this post)



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

Search: