Why do generator expressions return generators?

Brendan Eich brendan at mozilla.com
Fri Sep 6 09:11:22 PDT 2013

> Domenic Denicola <mailto:domenic at domenicdenicola.com>
> September 6, 2013 9:06 AM
> From: Brendan Eich [brendan at mozilla.com]
> Hmm, getting somewhere here. Could you expand on this? E.g. give a 
> code example where the observable results would be different if it 
> returned a iteratable-iterator instead of a generator?

In a debugger, I would see extra frames (without the debugger working to 
merge them to preserve the appearance of a generator with let blocks). 
Think about nested for-of heads, lifetimes of bindings. You need nested 
closures in general.


More information about the es-discuss mailing list