On Jun 12, 2013, at 8:17 AM, Jason Orendorff wrote: > On Tue, Jun 11, 2013 at 12:53 PM, Allen Wirfs-Brock <[email protected]> > wrote: > But, really, for-of (and Arrray.from and friends) should just accept either > an Iterable or an Iterator with priority given to Iterable > > Then the above an most conveniently be coded as: > > function giveMeAEmptyIterator( ) { > return { > next() {return {done: true}}, > } > } > > More convenient still: > > function *giveMeAEmptyIterator() {} > > This will work fine even if for-of remains as currently specified > (unconditionally calling the @@iterator method, as I think it should). > > -j
Yes, but the point was to illustrate what it looks like for folks who choose not to use a generator function. In general, I agree that using generators is usually what you want to do. Allen >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

