Code smell? Iterator prototype has iterator method that returns "this"

Andreas Rossberg rossberg at
Tue Jul 26 13:08:45 UTC 2016

The ES6 iterator/iterable story has been criticised more than once, by a
number of people. Too lazy to dig up all those threads, but if you search
es-discuss for iterable and iterator you will find it a reoccurring scheme.
AFAIK, this thread contained the first such discussion:

The short story from my POV is: the notion of iterators vs. iterables in
ES6 makes no coherent sense, but many people want their implicit
conversions despite any smell, and this basically provides (a
user-definable) one from anything to an iterator.

On 26 July 2016 at 04:16, Allen Wirfs-Brock <allen at> wrote:

> > On Jul 25, 2016, at 4:38 PM, John Lenz <concavelenz at> wrote:
> >
> > 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.
> The kind of object that is required is one that implements the Iterable
> interface (i.e., has a Symbol.interable method that returns an object that
> implements the Iterator interface).  What is unclear about that?
> _______________________________________________
> es-discuss mailing list
> es-discuss at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list