ES9 Sneak Preview

April 1st, 2014 by Mike Wilcox

Being an industry leader in the field of JavaScript, Club AJAX always has the pulse of the latest and greatest news and features in the world of JavaScript. Here we present a sneak preview of not just the next version of ECMAScript, but several versions ahead: ES9.

ES6 is introducing two new concepts: fat arrow => and skinny arrow ->. While useful, the perception of how these terms would be viewed was overlooked. They are not the most flattering.

With ES9, a new arrow will be introduced:

Sexy Arrow

~>

Sexy arrow will be similar in functionality to fat arrow and skinny arrow, but it will throw far fewer errors. This is because the code will be more forgiving… due to its sexiness.

ES6 will have the new let keyword which allows for block-level scoping of variables. While useful, it is not useful enough for the potential of JavaScript. A new scope level will be introduced:

Variable Level

We are excited about Variable level scoping. For engineers concerned about memory usage in their programs, they should consider Variable scoping, as the garbage collector will clean it up as soon as it is created.

Over the years, pranksters have been making fun of JavaScript type coercion by converting native objects to strings resulting in unusual side effects and screaming “WAT!” To finally silence these critics, ES9 will introduce three new levels of equality:

Self Equality (otherwise known as the Selfie)

====

The only items that will result in true will be those that are compared to themselves. At first, it may at first be confusing to find 2 does not equal 2, unless 2 was the original 2.

Uber Equality

=====

Uber equality brings a whole new level of comparison. It is so strict, that nothing is equal.

Quantum Equality

======

As you can probably guess, Quantum equality is equal or not equal, or both equal and not equal at the same time… but you never know for sure since when you test it, it changes. Unfortunately, there are still some bugs in that when testing for equality, the code is often found to be dead.

ES5 introduced bind() to work along with call() and apply() to assist with setting the context of a function. While useful, these functions do not have the versatility to work on a global scale like the new, ultimate binding function:

boson()

Boson is simple: it binds everything to everything.

We had been using Deferreds, and more recently Promises to help us with our asynchronous callbacks. ES6 will introduce Futures. Seeing the limitations of these helpers, ES9 will provide tools that will not only assit in asynchronous coding, but will make it faster. The first:

Warp

Warp will accept your call and return the response before real time. There is a subtle side effect that since warp calls are faster than the speed of light, they tend to crash every computer that uses them. Even in computers that support this feature, the code tends to not work correctly since the answer arrives before the problem. Regardless, computers can reach warp speed and keep up with JavaScript using a polyfill.

The other asynchronous helper is:

Wormhole

Wormholes are very fast and convenient, and they may return your async call, or might just dump you into a completely different program… or perhaps another dimension.

Finally, the TC39 committee remains vigilant in helping you keep you code terse and compact. ES6 will have fat and skinny arrows and optional parenthesis. In keeping with this trend, there will be more options in ES9:

Optional Operands

Opposite in concept to operational overloading, optional operands means math symbols don’t have to be used at all. JavaScript has gotten so fast and so intuitive, that it can deduce your intent. Addition is doen simply by placing numbers next to each other:

x 2 2 // x = 2 + 2

Subtraction is done the same way, only you reverse the numbers!

x 2 2 // x = 2 - 2

(The above example is more clear when different numbers are used)

Multiplication is done by stacking the numbers, as in a 4th grade math assignment:


2
2
x 
// x = 2 * 2

Division is not supported in ES9.

In addition to optional operands, there are more optional features in ES9: curly braces, semicolons, line breaks, tabs, quotes, and even spaces are all optional. Now you can write code without superfluous symbols to distract from what really matters. As an example:

x22x22~>31ddFooifx56yHelloWorld

As you can see, the new syntax allows for maximum expressiveness and moves well beyond jQuery and its rudimentary “chaining”.

Additional tech note:
As of ES9, the committee has yet to agree on a standard for inheritance. Perhaps by ES 10.

Be Sociable, Share!

Comments are closed.