On Apr 5, 2015, at 6:04 AM, Mark Volkmann wrote: > I thought that when an iterator returns done: true, the value should not be > used.
Why do you think that? The definition of the IteratorResult interface in the the ES6 spec. doesn't say that. > However, if a generator function ends by returning a value, done will be true > when that value is returned and the value should be used. Could be used. Whether a generator or any Iterator provides a meaningful value when it reach the the 'done' state depends upon its specific definition. > Given this, how can a consumer know the correct way to handle the value when > done is true? Clearly consumers shouldn't have to be aware of whether the > iterator is actually a generator and whether it ends by returning a value. An Iterator does not have to be a generator to provide a 'done' state value. In general, If you are going to do anything other than basic iteration, such as is performed by for-of, you need to know about the specific Iterator you are using. Allen
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

