Andy Wingo (2014-03-03T12:56:12.000Z)
domenic at domenicdenicola.com (2014-03-06T23:06:41.680Z)
On Mon 03 Mar 2014 12:49, Claude Pache <claude.pache at gmail.com> writes: > What does exactly the spec think what an iterable is? For what purpose? You rightly link to the denotation of Iterable; in context, it is used like this: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-getiterator Then there are is the "next" operation on iterators: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-iteratornext ...and reading that I see that my memory was off, that we don't fetch the "next" method eagerly, and instead look up the "next" property each time. Apologies for the misinformation. Thus you can: ```js function *g() { Object.defineProperty(g.prototype, 'next', {value:42}); yield 4; } for (var x of new g()) print (x); ``` The iterator is indeed an iterator when it is returned by @@iterator, but not after the first iteration :) Basically: you are looking for looking for certainty in structural typing of mutable values. You won't find it; or rather, if you do find it, it lasts only until the next piece of code that could mutate the world.