ECMAScript
Paradigm | Multi-paradigm: prototype-oriented, functional, imperative, scripting |
---|---|
Designed by | Brendan Eich, Ecma International |
First appeared | 1997 |
Typing discipline | duck, weak, dynamic |
Website | ecma-international |
Dialects | |
JavaScript, ActionScript, JScript, QtScript, JScript .NET, DMDScript, InScript | |
Influenced by | |
Self, HyperTalk, AWK, C, Perl, Python, Java |
Filename extension | .es |
---|---|
Internet media type |
application/ecmascript[1] |
Developed by | Sun Microsystems, Ecma International |
Initial release | June 1997 |
Latest release | Edition 3 December 1999 |
Type of format | Scripting language |
Extended from | JavaScript |
Website | ECMA-262, ECMA-290, ECMA-327, ECMA-357 |
ECMAScript is a scripting language, standardized by Ecma International in the ECMA-262 specification. The language is widely used on the web, and is often erroneously referred to as JavaScript or JScript, after two major dialects of the specification.
History
JavaScript was originally developed by Brendan Eich of Netscape under the name Mocha, later LiveScript, and finally renamed to JavaScript. In December 1995 Sun Microsystems and Netscape announced JavaScript in a press release.[2] In March 1996 Netscape Navigator 2.0 was out, featuring support for JavaScript.
Due to the wide-spread success of JavaScript as a client-side scripting language for web pages, Microsoft developed a compatible language known as JScript. JScript added new date methods to fix the non-Y2K-friendly methods in JavaScript, which were based on java.util.Date.[3] JScript was included in Internet Explorer 3.0, released in August 1996.
Netscape submitted JavaScript to Ecma International for standardization; the work on the specification, ECMA-262, began in November 1996.[4] The first edition of ECMA-262 was adopted by the ECMA General Assembly of June 1997.[5]
ECMAScript is the name of the scripting language standardized in ECMA-262. Both JavaScript and JScript aim to be compatible with ECMAScript, while providing additional features not described in the ECMA specification.
The name "ECMAScript" was a compromise between the organizations involved in standardizing the language, especially Netscape and Microsoft. Brendan Eich, the creator of JavaScript, is on record as saying that "ECMAScript was always an unwanted trade name that sounds like a skin disease."[6]
Versions
There are three editions of ECMA-262 published, and the work on the fourth edition is in progress.
Edition | Date published | Differences to the previous edition |
---|---|---|
1 | June 1997 | First edition, editor Guy L. Steele, Jr. |
2 | June 1998 | Editorial changes to keep the specification fully aligned with ISO/IEC 16262 international standard; editor Mike Cowlishaw. |
3 | December 1999 | Added regular expressions, better string handling, new control statements, try/catch exception handling, tighter definition of errors, formatting for numeric output and other enhancements; editor Mike Cowlishaw. |
4 | Work in progress | Multiple new concepts and language features — see the section "Fourth edition" below |
In June 2004 Ecma International published ECMA-357 standard, defining an extension to ECMAScript, known as E4X (ECMAScript for XML).
ECMA also defined a "Compact Profile" for ECMAScript — known as ES-CP, or ECMA 327 — which is designed for resource-constrained devices. Several of the dynamic features of ECMAScript (such as the "eval" function) are made optional, thus allowing the runtime to make more assumptions about the behaviour of programs and therefore make more performance trade-offs when running the code. The HD DVD standard is one place where the ECMAScript Compact Profile is used in favour of full ECMAScript in order to reduce processing and memory requirements on a device.
Features
ECMAScript is dynamic and structured.
Syntax
Dialects
ECMAScript is supported in many applications, especially web browsers, where it is commonly called JavaScript. Dialects typically include their own, different standard libraries, of which some are standardized separately — such as the W3C-specified DOM. Some implementations, such as ActionScript used in Flash, have a completely different set of libraries. This means that applications written in one dialect of ECMAScript will not likely work in another, unless they are designed to be compatible.
Application | Dialect | Latest dialect version | Corresponding ECMAScript edition |
---|---|---|---|
Mozilla Firefox7, the Gecko layout engine, SpiderMonkey, and Rhino | JavaScript | 1.8 | ECMA-262, edition 3 1 |
Internet Explorer | JScript | 5.7 | ECMA-262, edition 3 |
Opera | ECMAScript, with extensions for both JavaScript and JScript | 1.3/1.5 | ECMA-262, edition 3 |
KHTML layout engine, KDE's Konqueror, and Apple's Safari8 | JavaScript | 1.5 6 | ECMA-262 |
Appweb Web Server | Ejscript | 0.9.2 9 | ECMA-262, Edition 4 |
Microsoft .NET Framework | JScript .NET | 8.0 | ECMA-262, edition 3 2 |
Adobe Flash and Adobe Flex | ActionScript | 2
3 |
ECMA-262, edition 3 3
ECMA-262, edition 4 4 |
Adobe Acrobat | JavaScript | 1.5 | ECMA-262, edition 3 |
General purpose scripting language | DMDScript | 1.06 | ECMA-262 |
OpenLaszlo Platform | JavaScript | 1.4 | ECMA-262, edition 3 5 |
CriScript, JScript for game platforms | CriScript | 0.9.0 | ECMA-262, edition 3 |
iCab | InScript | 3.22 | ECMA-262, edition 3 |
Max/MSP | JavaScript | 1.5 | ECMA-262, edition 3 |
Samba 4 and embedded servers. (ASCII only, no floats; removes: try catch throw break continue switch while do with === !== <<< >>>, prefix ++ --, regular expressions, array and object literals, Number, Date, Regex, various methods) | Embedded JavaScript | ? | ECMA-262 |
Note (1): Gecko 1.8.1 has partial support of E4X (documentation) and a few other features (New in JavaScript 1.7).
Note (2): Microsoft asserts that JScript 8.0 supports "almost all of the features of the ECMAScript Edition 3 Language Specification" but does not list the unsupported features.
Note (3): In addition to supporting ECMA-262 edition 3, ActionScript 2 also included support of properties, methods, and mechanisms that were proposed in early draft specifications of as yet unseen versions of ECMAScript. It remains to be seen if ActionScript will stay in sync with future changes to the ECMAScript specifications.
Note (4): Adobe asserts it implements the preliminary edition 4 of ECMA-262[7]
Note (5): As of version 4, OpenLaszlo implements standard ECMAScript edition 3 with some preliminary ECMAScript edition 4 extensions[8]
Note (6): The current WebKit binaries, as of April 2007, also implement at least part of the Javascript 1.6 extras
Note (7): The Mozilla implementations, (SpiderMonkey in the C programming language and Rhino in the Java programming language), are used in several third-party programs, including the Yahoo! Widget Engine (Konfabulator) and the Macintosh system-level scripting language JavaScript OSA.
Note (8): Apple's Safari uses JavaScriptCore which is based on the KDE KJS library.
Note (9): Embedthis asserts it implements the preliminary edition 4 of ECMA-262[9]
Version correspondence
The following table is based on [2] and [3]; items on the same line are approximately the same language.
JavaScript | JScript | ECMAScript |
---|---|---|
1.0 (Netscape 2.0, March 1996) | 1.0 (IE 3.0 - early versions, August 1996) | |
1.1 (Netscape 3.0, August 1996) | 2.0 (IE 3.0 - later versions, January 1997) | |
1.2 (Netscape 4.0-4.05, June 1997) | ||
1.3 (Netscape 4.06-4.7x, October 1998) | 3.0 (IE 4.0, Oct 1997) | Edition 1 (June 1997) / Edition 2 (June 1998) |
1.4 (Netscape Server only) | 4.0 (Visual Studio 6, no IE release) | |
5.0 (IE 5.0, March 1999) | ||
5.1 (IE 5.01) | ||
1.5 (Netscape 6.0, Nov 2000; also later Netscape and Mozilla releases) |
5.5 (IE 5.5, July 2000) | Edition 3 (December 1999) |
5.6 (IE 6.0, October 2001) | ||
1.6 (Gecko 1.8, Firefox 1.5, November 2005) | Edition 3, with some compliant enhancements: E4X, Array extras (e.g. Array.prototype.forEach ), Array and String generics (New in JavaScript 1.6)
| |
1.7 (Gecko 1.8.1, Firefox 2, October 2006) | Edition 3 plus all JavaScript 1.6 enhancements, plus Pythonic generators and array comprehensions ([a*a for (a in iter)] ), block scope with let , destructuring assignment (var [a,b]=[1,2] ) (New in JavaScript 1.7)
| |
1.8 (Gecko 1.9, Firefox 3, June 2008) | Edition 3 plus all JavaScript 1.7 enhancements, plus expression closures (function(x) x * x ), generator expressions, and more (New in JavaScript 1.8)
| |
JScript .NET (ASP.NET; no IE release) | (JScript .NET is said to be designed with the participation of other ECMA members) | |
JavaScript 2.0 (Work in progress) | Edition 4 (Work in progress; see the section "Fourth edition" below). |
Fourth edition
The ECMA-262 fourth edition is the first major update to ECMAScript since the third edition published in 1999. The specification (along with the reference implementation) is currently under development and was targeted for completion by October 2008.[10] An overview of the language was released by the working group on October 22, 2007.
As of August 2008, the ECMAScript 4th edition proposal has been scaled back into a project codenamed ECMAScript Harmony.
Features
The new version of the language is mostly backwards compatible with ECMAScript 3 (see below), while adding multiple new features, such as:
- Classes
- Structural types
- Packages and namespaces
- Optional type annotations and static typing
- Generators and iterators
- Destructuring assignment
- JSON encoding/decoding
- Algebraic data types
ECMAScript 4 intends to better support "programming in the large" and to let programmers sacrifice some of the script's ability to be dynamic for performance. For example, Tamarin — the virtual machine for ActionScript developed and open sourced by Adobe — has JIT compilation support for certain classes of scripts.
Bug fixes and backwards compatibility
In addition to introducing new features, some ES3 bugs are fixed in edition 4.[11] A document describing known incompatibilities between ES3 and ES4 is available.
Implementations
Since the specification is not yet finished, there are no full implementations of the language at this time. However several implementations are in progress:
- TG1 is working on the reference implementation in SML/NJ and the work-in-progress is available.
- Tamarin, an open-source ECMAScript engine, will implement ES4. Mozilla plans to use Tamarin in Firefox 4.
- Ejscript is a new implementation aimed at embedded applications and systems.
- Jangaroo is a compiler from an ECMAScript 4 subset to ECMAScript 3 implemented in Java.
- Mascara is a compiler from an ECMAScript 4 subset to ECMAScript 3 implemented in Python.
- According to Brendan Eich, there are several other "industry-scale implementations underway".[12]
History
Work started on Edition 4 after the ES-CP (Compact Profile) specification was completed, and continued for approximately 18 months where slow progress was made balancing the theory of Netscape's JavaScript 2 specification with the implementation experience of Microsoft's JScript .NET. After some time, the focus shifted to the E4X standard.
The update is not without controversy. In late 2007, a debate between Eich, now the Mozilla Foundation's CTO, and Chris Wilson, Microsoft's platform architect for Internet Explorer, became public on a number of blogs. Wilson cautioned that because the proposed changes to ECMAScript made it backwards incompatible in some respects to earlier versions of the language, the update amounted to "breaking the Web,"[13] and that stakeholders who opposed the changes were being "hidden from view".[14] Eich responded by stating that Wilson seemed to be "repeating falsehoods in blogs" and denied that there was attempt to suppress dissent and challenging critics to give specific examples of incompatibility.[15] He also pointed out that Microsoft Silverlight and Adobe AIR rely on C# and ActionScript 3 respectively, both of which are larger and more complex than ECMAScript Edition 3.[16]
ECMAScript 3.1
Microsoft, Yahoo, and other 4th edition dissenters formed their own subcommittee to design a less ambitious update of ECMAScript 3, tentatively named ECMAScript 3.1. This edition would focus on security and library updates with a large emphasis on compatibility. After the aforementioned public sparring, the ECMAScript 3.1 and ECMAScript 4 teams agreed to a compromise: the two editions would be worked on in parallel, with coordination between the teams to ensure that ECMAScript 3.1 remains a strict subset of ECMAScript 4 in both semantics and syntax.
However, the differing philosophies in each team resulted in repeated breakages of the subset rule, and it remained doubtful that the ECMAScript 4 dissenters would ever support or implement ECMAScript 4 in the future. After over a year since the disagreement over the future of ECMAScript within the ECMA Technical Committee 39, the two teams reached a compromise: ECMA TC39 announced it would focus work on the ECMAScript 3.1 project with full collaboration of all parties, and it would target two interoperable implementations by early 2009.[17]
ECMAScript Harmony
In the same announcement, ECMA TC39 also stated that the ECMAScript 4 proposal would be superseded by a new project, code-named ECMAScript Harmony. ECMAScript Harmony will include syntactic extensions, but the changes will be more modest than ECMAScript 4 in both semantic and syntactic innovation. Packages, namespaces and early binding from ECMAScript 4 are no longer included for planned releases. In addition, other goals and ideas from ECMAScript 4 are being rephrased to keep consensus in the committee; these include a notion of classes based on existing ECMAScript 3 concepts combined with proposed ECMAScript 3.1 extensions.[18] As of August 2008, there is no publicly announced release date for ECMAScript Harmony. Depending on how ECMASript 3.1 is officially named, ECMAScript Harmony may end up being the new ECMAScript 4th edition.
See also
- E4X
- List of ECMAScript engines
- Comparison of layout engines (ECMAScript)
- Document Object Model
- JavaScript
- ActionScript
References
- ^ RFC 4329
- ^ JavaScript Press Release
- ^ [1]
- ^ JavaScript Standardization Press Release
- ^ ECMAScript 3rd Edition specification
- ^ es4-discuss: Will there be a suggested file suffix for es4?
- ^ The Kiwi Project: AS3 language 101 for C/C++ coders
- ^ OpenLaszlo 4
- ^ Ejscript Overview
- ^ es4-discuss: ES4 overview paper released
- ^ John Resig - Bug Fixes in JavaScript 2
- ^ es4-discuss: is ES4 getting too bloated?
- ^ IEBlog: ECMAScript 3 and Beyond
- ^ Albatross!: What I think about ES4
- ^ Brendan's Roadmap Updates: Open letter to Chris Wilson
- ^ Brendan's Roadmap Updates: My @media Ajax Keynote
- ^ ECMAScript Harmony announcement
- ^ John Resig: ECMAScript Harmony
External links
- ECMAScript 4 Reference Implementation
- Standard ECMA-262 ECMAScript Language Specification 3rd edition (December 1999)
- Standard ECMA-290 ECMAScript Components Specification (June 1999)
- Standard ECMA-327 ECMAScript 3rd Edition Compact Profile (June 2001)
- Standard ECMA-357 ECMAScript for XML (E4X) Specification (June 2004)
- Export Root of the ECMAScript 4 Committee Wiki
- The World of ECMAScript : John Resig's map on ECMAScript
- C programming language family
- Curly bracket programming languages
- Domain-specific programming languages
- JavaScript dialect engines
- JavaScript programming language family
- Object-based programming languages
- Prototype-based programming languages
- Computer and telecommunication standards
- Scripting languages
- Ecma standards