Generators (and, I s'pose, iterators)

I’ve just been looking at these again in PHP (and ECMAScript by comparison), and figured I’d raise it here as well, to add some content.

What do ppl think of adding iterators & generators to CFML (or whatever the .lucee stuff will be called when it finds a name)?

The relevant Jira ticket is here: LDEV-61, an my most recent PHP investigations are here: “Random PHP (7) bits: improvements to generators”. I offer the latter just to frame my position and understanding of the things.

In short, a generator is a function which returns a value by yielding it, as opposed to returning it. And the difference is that next time the function is called, processing continues from after the yield statement, rather than restarting the function. My use cases for it have been to generate infinite sequences (eg: primes or the fibonacci series), but only generating them one element at a time.

Anyway, I perhaps don’t need to explain them too much as they’re a pretty common concept in other languages.

Thoughts? Anyone else use 'em elsewhere and have a better grip on them than I do (not hard), and have real world examples of where they’re handy?