ecma script

What’s new in ECMAScript 2018

Four new feature proposals for the specification underlying JavaScript are finalized and four others are under consideration

ECMAScript, the standard specification underlying JavaScript, is on track for a new release, likely in June.

So far, four proposals have been finalized for inclusion in the ECMAScript 2018 specification, said Zibi Braniecki, a senior software engineer at Mozilla who participates in the development of ECMAScript.

The four proposals include:

  • Lifting of the template literal restriction, to enable the embedding of languages, including domain-specific languages (DSLs). Currently, restrictions on escape clauses make this a problem. The revision cleans up the behavior of literals, letting them be used for DSLs so programmers can create their own mini-languages if needed.
  • Adding the s (dotAll) flag for regular expressions, providing consistent behavior for these expressions. The feature is intended to address limitations in which the dot (.) in regular expressions does not match line-terminator characters, said author Axel Rauschmeyer, who has focused on JavaScript. The s flag changes that. This flag will operate on an opt-in basis, so existing regular expressions patterns will not be affected.
  • Async iterators, adding syntactic support for asynchronous iteration using AsyncIterable and AsyncIterator protocols. The feature makes possible a for-wait-of iteration statement while adding syntax for creating async generator functions and methods.
  • Rest/spread properties, providing a minor syntactic improvement.

Async iterators enable a new class of software to be written, solving new classes of problems, Braniecki said. The capability combines two powerful features added to JavaScript in recent years: asynchronous operations and iterators/generators. Generators and iterators let code be executed lazily while asynchronous operations allow for code that does not block. Combined, these let developers write lazy code that will not block.

There are four other features under strong consideration, which would make it easier to program with JavaScript, Braniecki said. These include:

  • Regexp (regular expression) look-behind assertions, fixing a shortcoming with lookarounds, which are zero-width assertions that match a string without consuming anything. Currently, lookaround assertions can be used in a forward direction but not a backward direction. With lookbehind assertions, developers would be able to ensure that a pattern is or is not preceded by another; for example, matching a dollar amount without capturing the dollar sign.
  • Regexp Unicode property escapes, giving developers a better way to access Unicode character properties. Property escapes in the form of \p{…} and \P{…} would be added.
  • Promise.prototype.finally, for writing cleaner code when a programmer does not does not close a socket or clean up memory. A class of errors would be removed.
  • Updating the function Function.prototype.toString. The toString () method would return a string representing a function’s source code.

Braniecki expects the ECMAScript 2018 features to be implemented in browsers this year. Some already have been implemented.

Braniecki considers ECMAScript 2018 to be a fairly modest release. Next year, he anticipates bigger capabilities for ECMAScript, with conversations being held about asynchronous iterators and extending classes.

ECMAScript standardization Stages

I guess you have seen “X is in Stage Y” when you look at some cool new JavaScript feature. This block is an attempt to give an introduction to what that means.


Stage 0 – Strawman: just an idea, possible Babel plugin.

Stage 1 – Proposal: this is worth working on.

Stage 2 – Draft: initial spec.

Stage 3 – Candidate: complete spec and initial browser implementations.

Stage 4 – Finished: will be added to the next yearly release.

Where to get the ECMAScript 2018 specification

You can read the draft specification on GitHub. A list of proposals is posted as well.

Leave a Reply