As we near the finalization of the proposal, it’s looking like ES8 is going to deliver much more than the simple updates of its ES7 predecessor! We wanted to take a few moments to highlight our 5 favorite things about the upcoming 2017 release.
1. Object.entries and Object.values
This change is one we’re very excited about, and something we’ve already shimmed in Dojo 2.
When an object is used as a hash filter, you often need to know the values of an object. This standardizes an approach found in most libraries and toolkits.
Similarly, it is often useful for iteration or serialization to have an array of key/value pairs from an object, or its entries. With the ES6 Map constructor accepting an iterable of entries, and its associated entries iterator, this makes it easier to convert a plain object to a Map via passing entries to the Map constructor.
Review on Github: Object.values/Object.entries
2. String.prototype.padStart / String.prototype.padEnd
In the wake of the leftpad incident, efforts were made to finally add string padding to the language. This is something we’ve had in Dojo, and we quickly moved to create a shim for string padding as well.
This is a simple feature that was long overlooked in the language because it was so simple to implement, but we’re happy to have this be part of the language.
Review on Github: String.prototype.padStart / String.prototype.padEnd
ES lacks a method for properly copying properties between two objects. This proposal solves this seemingly simple but complex problem that has been implemented at times in almost every JS toolkit or framework. Currently it is a stumbling block for efficient immutability, true composition of ES Classes, something that would benefit Decorators, and just less surprising in general than Object.assign.
Review on Github: Object.getOwnPropertyDescriptors
4. Async functions
The introduction of promises and generators in ES greatly improves how we write asynchronous code by improving the control flow structures parallel to those of generators.
This change is pretty significant and we’re very happy to see this arrive in the language as it was a major missing piece for how we write async code.
Review on Github: Async functions
5. Shared memory and atomics
Of the finished ES8 features, this one will probably take the most time for people to understand and leverage. It’s been intentionally implemented in a very minimal manner, with the specification stating “At this time the proposal adds only low-level primitives to ECMAScript; we expect the developer community to put together abstractions that are useful in specific domains”. It’s very encouraging to hear that the approach is to wait and see how people use this feature before adding to it.
Review on Github: Shared memory and atomics
Update: Two more features in ES8
Since this post was first published, one more feature has been finalized for ES8/ES2017, the lifting of template literal restrictions, which makes it much easier to embed alternative Domain Specific Languages as template literals.
Here’s our wishlist for ES9 and beyond!
- Observables, a key for reactive architectures (Observables shim for Dojo 2)
- Global, a standard for referencing the global object consistently (global shim for Dojo 2)
- trimStart/trimEnd, the analog of padStart/padEnd
- import, a dynamic import that was missing from the ES modules standard
- Class and property decorators (already implemented in TypeScript)
- Asynchronous iteration
- Single Instruction Multiple Data (SIMD), which should speed up rendering and animation with things like WebGL, Canvas, etc.)
Update: Based on comments and feedback, it’s worth mentioning that yes, we know that the official names are ES2017 and ES2018. However, they are still called the 8th and 9th edition of ES internally. We think a better naming scheme would have been ES15, ES16, etc., but if everyone feels this strongly about the names, we’ll start calling them ES2017, etc. in future posts. Thanks again for the the feedback!