The ES6 iteration protocol

Allen Wirfs-Brock allen at
Mon Apr 6 21:22:17 UTC 2015

> On Apr 6, 2015, at 2:23 PM, Dmitry Soshnikov <dmitry.soshnikov at> wrote:
> I guess all built-in iterators return themselves for `Symbol.iterator` protocol. So they are all "singletons". I described in detail where confusion/substitution of concepts happens in that analysis in the recent two comments.

I don’t think “singleton” is the correct term for the concept that Axel is trying to describe.  A “singleton” is normally an kind of object for which there is only a single instances.  There may be many instances of, for example %ArrayIterator%, so it isn’t correct to call %ArrayIterator% a singleton

What Axel is describing might be characterized as “self iterable”, it returns itself when recieving a Symbol.iterator request.


More information about the es-discuss mailing list