JavaScript spec adds async functions, shared memory

(Image: JavaScript)

6 February 2017

A few months before its expected approval, ECMAScript 2017, the latest official specification underlying JavaScript, has been fleshed out with async functions and shared memory capabilities.

ECMAScript 2017 is due to be finalised in June, in line with a release cadence that has seen midyear upgrades recently. “Async functions are a terrific tool for writing asynchronous code, and SharedArrayBuffer (shared memory) will enable library authors to experiment with real multiprocessing in JavaScript,” said blogger Axel Rauschmayer, who follows JavaScript’s development.

Async functions were a candidate for inclusion last year but were pushed out to this year. Shared memory, meanwhile, is coupled with atomics, providing atomic operations on shared memory locations.

ECMAScript 2017 also will include Object.values/Object.entries. Similar to the Object.keys capability, Object.values and Object.entries would return arrays, with an ordering matching Object.keys, with indices of all three resulting arrays matching the same key, value, or entry of an object, according to the ECMA proposal.

Also on tap is string padding, intended to improve the performance of the web and developer productivity. “Without a reasonable way to pad a string using native methods, working with JavaScript strings today is more painful than it should be,” the proposal states. String padding functions exist in a majority of websites and frameworks.

The Object.getOwnPropertyDescriptors feature will simplify some common boilerplate, and allowing trailing commas in function parameter lists will provide for code attribution while making no changes to semantics. The proposal states that other languages, including Python and D, allow this capability so that code contributors can end a parameter addition with a trailing comma in a per-line parameters list, addressing the issue of code attribution.

Different features of ECMAScript are implemented in browsers at varying times. The most recent version of the specification, ECMAScript 2016, was approved last June and was limited in scope.



IDG News Service

Read More:

Back to Top ↑