What to expect with the new JavaScript standardization (ECMAScript 5)

ECMAScript 5, the first JavaScript standardization since 1999, will be released later this year. Though not as thorough an overhaul as some programmers would have liked, ECMAScript 5 provides important updates that fix common pitfalls from ECMAScript 3 and allow developers to create more secure, robust programs.

ECMAScript 5, the first JavaScript standardization since 1999, will be released later this year. Though not as thorough an overhaul as some programmers would have liked, ECMAScript 5 provides important updates that fix common pitfalls from ECMAScript 3 and allow developers to create more secure, robust programs.

Perhaps the most applauded new feature of ECMAScript 5 is native JSON support. In ECMAScript 3, methods to implement JSON data in programs, such as JSONP and json.js, caused security and scalability issues. Mozilla developer John Resig further analyzed the need for native JSON support on his blog. It appears his argument has been heeded. With native JSON support, common security and scalability issues are solved. And while most major browsers implemented native JSON support around the time of the first ECMAScript 5 drafts, the final standardization should eliminate any cross-browser disparities.

Several features were added to ECMAScript 5 to put programmers more on par with browser providers. First, a new property attribute control API has been introduced. The API has new semantics, which help to eliminate double negatives: "ReadOnly" becomes "writable," "DontEnum" becomes "Enumerable," and "DontDelete" becomes "Deletable." The API also allows the attributes of properties created by JavaScript code to now be controlled by the programmer.

In addition to the new API, accessor (getter/setter) properties were added, giving properties the ability to compute on assignment. The combination of accessor properties and a new API allows JavaScript programmers to better emulate the DOM API. Google researcher and ECMAScript committee member Mark S. Miller provided details on this feature and others in a recent Google-hosted presentation on ECMAScript 5.

Other features help make JavaScript a more robust programming language. A "freeze" function was added to prevent the properties within an object from being changed, effectively creating tamperproof objects. A "strict mode" was added to help programmers create more secure programs with fewer errors. In strict mode, certain risky actions, such as accessing a global object, are automatically denied, and assignments that once failed silently are thrown. Strict mode can be applied to an entire script or to individual functions within a script.

Additional new features in ECMAScript 5 include additional array manipulation functions and reflective creation and inspection of objects. While some viewers have expressed disappointmentin the limited changes made with the new standardization, the specification committee has stressed it is more concerned with fixing what was wrong with the previous edition rather than adding capabilities to JavaScript that could cause new problems.

Steps toward further improvement of JavaScript are well underway. The next standardization, known as ECMAScript Harmony, is already being prepared, and will contain many new updates, including some originally included with the now-defunct ECMAScript 4 proposal.


This was first published in October 2009

Dig deeper on Web services: Presentation, portals and clients

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchSoftwareQuality

SearchCloudApplications

SearchAWS

TheServerSide

SearchWinDevelopment

Close