Normative: add Iterator.prototype.chunks and Iterator.prototype.windows #3970
It's debatable whether constructor should be listed before other properties, but the status quo is to sort it alphabetically with the rest so chunks should go before it.
(I also acknowledge that most people will not care about a minor ordering issue whatsoever and this is pedantic. :))
The rendered spec preview for this PR is available as a single page at https://tc39.es/ecma262/pr/3970 and as multiple pages at https://tc39.es/ecma262/pr/3970/multipage .
<hidden purpose="for-rewritable-pr-comment-action-use" value="tc39_pr_preview_comment"></hidden>
I'm kind of surprised by this ordering, but I also generally don't care about section ordering, so okay.
Approved these changes.
Approved these changes.
Just to clarify, do we expect to ignore exceptions posted back to the iterator via iter.throw() here? The IfAbruptCloseIterator on step 7.iv.2 below expands into an ? IteratorClose(iteratorRecord, value), so would throw when there are still elements remaining.
Same as above. Are we supposed to ignore exceptions from the final Yield?
There is no %IteratorHelperPrototype%.throw(), and the one on %GeneratorPrototype% has the wrong brand to be used on iterator helpers, so it doesn't come up.
We don't appear to be consistent with respect to optional parameters in built-in functions/methods. Date.UTC, for example, uses "is present", while String.prototype.endsWith uses "is undefined". We don't appear to call out within the specification what the difference is, nor do we have an editorial convention that calls this out.
That's because endsWith is newer, and Date.UTC is legacy. For APIs post-ES6, we don't differentiate absence from undefined (except with cause which is a special case)
It's more of a normative convention than an editorial one, and in the normative conventions we say
In most cases, a built-in function being called with fewer arguments than expected is treated the same as being called with undefined for the remaining arguments.
although that could stand to be promoted to its own convention rather than being embedded within a different one.
Approved these changes.
Approved these changes.
That's because endsWith is newer, and Date.UTC is legacy. For APIs post-ES6, we don't differentiate absence fromundefined(except withcausewhich is a special case)
And Iterator.prototype.reduce, since there's a difference between no initial value and an initial value of undefined.
linusg
michaelficarra
This is the Stage 4 PR for https://github.com/tc39/proposal-iterator-chunking.