ECMAScript 5: The Long-Awaited Javascript Update

Ten years in the making, Javascript 5 doesn’t break new ground but contains useful enhancements.

JavaScript (which is what most people call it) is a trademarked name owned by Sun, and is just one of many implementations of the ECMAScript language. ECMAScript 5 has recently been released, a full 10 years after the previous version of the language came out.

The scripting language is primarily used in web browsers which have obviously changed drastically since 1999, so an update to the ECMAScript language has been needed for some time. Despite the wait, the updates are not groundbreaking, but they are useful.

Edition 3 of the language was released in 1999, and there never was an Edition 4. The committee designing the language basically split into two warring (or at least severely disagreeing) factions, each wanting to take the language in a different direction.

One of these directions was incredibly ambitious, and included modules and classes. However, due to disagreements, as well as valid arguments from both sides, the group released a much less ambitions edition, which is what we are now seeing as Edition 5.

There are plans for another version in the future that will implement some of the more exciting features. The working name for this edition is Harmony because the warring groups can work in, well, you get the picture. Wikipedia has a nice entry on what exactly went down during the ECMAScript wars, with much more detail than I have room for.

Edition 5The Nitty-Gritty

Before covering what exactly Edition 5 gives us, it’s important to remember one thing; there are currently, no browsers that support it. Edition 5 has been published as a final draft, and it probably won’t be approved until late 2009 as an official specification.

Furthermore, only after browsers fully support the language will programmers be able to take full advantage of the new language features. However, you don’t have to wait as long as you might think. Internet Explorer Version 8.0 includes many of the language’s new features already, and other browsers will have the features soon, as well.

The updates to the language are not particularly shocking or exciting. Rather, the updates are modest and useful, simplifying some of the programming, particularly in areas where developers usually relied on third-party libraries.

For starters, the language includes a new strict mode feature. Technically speaking, strict mode is a subset of the language. When running in strict mode, the runtime engine will not allow certain aspects of the language to function, aspects that could result in buggy programming. For example, the ‘with’ statement is particularly useful for writing shorthand code. Under strict mode, however, you cannot use the ‘with’ statement.

That, of course, is not to say the language has a buggy feature. The ‘with’ statement isn’t buggy; rather, it’s easy for a sloppy programmer to write buggy code if relying too heavily on the ‘with’ statement. Now, programmers should certainly know their own abilities, and can therefore decide if they want to write code for the strict mode or not.