ECMAScript is the name of the scripting language standardised by the ECMA as ECMA-262. It is currently in its third edition, which is implemented as JavaScript 1.5 in Spidermonkey and Rhino on Mozilla/Netscape 6 and JScript 5.5 on Microsoft browsers. ECMAScript has the distinction of being the web's only standard scripting language.

A common complaint is that ECMAScript is not implemented the same across browsers. This is only partly true. If you follow the ECMA-262 specification, your code will work nearly 100% of the time. The complications arise primarily from the differing document object models, which is unrelated to ECMAScript except for the fact that there are ECMAScript language bindings to access them. With the W3C's standardisation of the DOM, however, and ECMAScript bindings in the appendix, this problem should be resolved as older browsers are phased out.

ECMAScript is a dynamic scripting language based on Netscape's JavaScript and Microsoft's JScript. The invention is credited to Brendan Eich at Netscape (see LiveScript), and was first implemented in Netscape's Navigator 2.0 browser. The ECMA started development of the standard in Novermber 1996. The first edition was adopted by the ECMA in June 1997. It was submitted to ISO/JTC 1 for adoption and was published as ISO/IEC 16262 in April 1998. ECMAScript was updated to its second edition to align itself with the ISO standard in June 1998. The third edition was adopted by the ECMA in December 1999.

The 3rd edition offers many improvements and capabilities, including more powerful regular expressions, better string handling, new control statements, and try/catch exception handling. The Mozilla team is working with the ECMA TC39 committee on the next version.

The language itself is interesting in that it is object-based but scripts can be written in a completely procedural manner. The other interesting thing is that everything in ECMAScript is an associative array. Objects are just arrays of properties. Even object methods (member functions) are properties!

ECMAScript's object-oriented model is based on prototype-based inheritance, and does not use classes like more OOP-like languages like Smalltalk, C++, and Java. Constuctors are used to create objects, and each constructor has a prototype property that defines the object. This prototype can have a prototype itself, creating a prototype chain of inheritance.

Doing any OOP stuff beyond that is extremely difficult, if not impossible. Out of all the patterns in the GoF book, I can only think of a way to implement a third of them, and most of that is in a halfassed way.

For a copy of the standard, visit the ECMA website at http://www.ecma.ch. The standard is available in Adobe Acrobat (PDF) and PostScript formats. Hardcopies are also available, free of charge. It's pretty cool getting a package from Switzerland (well, to me, anyway) and they're printed and bound nicely.

Log in or register to write something here or to contact authors.