I can’t find the rationale as to why that isn’t allowed. Is it because 
iterators can’t be recognized as safely as iterables?

If we did enable for-of (and Array.from) for iterators, we would get two 
advantages:

- Generators would not need to have a method @@iterator.
- Many functions actually return iterators, but have to turn them into 
iterables (by adding a method @@iterator that returns `this`) to work with 
for-of.

Axel

-- 
Dr. Axel Rauschmayer
[email protected]

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to