Exactly, that's what I tried to explain. Since in one case it considers just an iterable (an array), and in other case -- an iterator (which is by "coincidence" is also an iterable). But an array's iterator is an iterable as well, and also always returns itself for iterator protocol.
Yeah, the "self-iterable" makes much more sense in this case. Dmitry On Monday, April 6, 2015, Allen Wirfs-Brock <al...@wirfs-brock.com> wrote: > > > On Apr 6, 2015, at 2:23 PM, Dmitry Soshnikov <dmitry.soshni...@gmail.com > <javascript:;>> 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. > > Allen > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss