Yes, but at the cost of being able to reason / declare what kind of object is actually required. But, I'm sure there is nothing that can be changed here.
On Mon, Jul 25, 2016 at 4:31 PM, Tab Atkins Jr. <[email protected]> wrote: > On Mon, Jul 25, 2016 at 4:28 PM, John Lenz <[email protected]> wrote: > > I understand the way it is used, but I don't understand why. "for-of" > > could have been spec'd to take either an Iterable (an object with an > > [Symbol.iterator] method) or an Iterator. Or just an Iterable. > > Not just for-of, but the whole rest of the world (in particular, > anything that directly consumes iterables) would also have to make > that distinction. Much easier to just let everyone pretend that an > iterator is iterable, so you can use a common API between the two > types. (Also, Python already worked this way, and a lot of JS > iterator details were copied from Python originally.) > > ~TJ >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

