ECMAScript TC39 - Iterators

nidhinkumarnidhinkumar
2 min read

The ECMAScript TC39 committee gathered last week in Tokyo and they have analyzed the new language proposals and moved to one of the five maturity stages they have to go through before they are officially adopted in the language this time.

  • STAGE 0 - Strawman Idea

  • STAGE 1 - Proposal Concept

  • STAGE 2 - Draft Specs

  • STAGE 3 - Candidate Implementation

  • STAGE 4 - Finished

Today we will see about Iterator Helpers which reached STAGE 4 and now they are now considered feature complete with plan to merge them in the official specification soon.

Iterators are useful way to represent large or possibly infinite enumerable datasets but they lack helpers which makes them as easy as to use arrays and other finite data structures.

So the proposal introduces a collection of new methods on the iterator prototype to allow general usage and consumption of iterators.

The exposed methods are similar to what you have already used to and remember that all of the iterator producing methods are lazy which means they will consume the iterator when it is needed

Iterator Sequencing

ITERATOR Sequencing proposal which has reached STAGE 2.7.

This usecase is straight forward often you have two or more iterators the values of which you would like to consume in a sequence as if they were a single iterator

A common solution in other libraries is to expose a concat method, and this is what the proposal of Javascript also looks like

Note: These features are not in the standard yet and some of them might never end up being adopted

0
Subscribe to my newsletter

Read articles from nidhinkumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

nidhinkumar
nidhinkumar