What’s new in ECMAScript 2018

What’s new in ECMAScript 2018

Two new features for the specification underlying JavaScript are finalized and four others are under consideration

Credit: Iwan Gabovitch

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

So far, two proposals have been finalized for inclusion in the ECMAScript 2018 specification. Both are considered as fairly foundational work and not major features, said Zibi Braniecki, a senior software engineer at Mozilla who participates in the development of ECMAScript.

The two 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 minilanguages if neeeded.
  • 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.

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.

Where to get the ECMAScript 2018 specification

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

Follow Us

Join the newsletter!


Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Show Comments