I. Birth of JavaScript
In May 1995, a person named Brendan Eich created JavaScript in 10 days.
II. Standardization of JavaScript Language
Initially, the JavaScript language had 2 standards:
-
ECMA-262: Main standard, managed by ECMA International organization (Ecma International)
-
ISO/IEC 16262: Second standard, managed by International Organization for Standardization (ISO) and International Electrotechnical Commission (IEC)
For trademark copyright reasons, the specification standard refers to this language as ECMAScript, so in principle JavaScript and ECMAScript refer to the same thing, but sometimes they are distinguished:
-
JavaScript: Refers to the language and its implementations
-
ECMAScript: Refers to the language standard and language versions, for example, ES6 represents the 6th version of the language (standard)
P.S. ECMA in ECMAScript comes from ECMA International organization responsible for managing the main standard. This organization was originally called European Computer Manufacturers Association, later its influence scope was not limited to Europe, so it was renamed Ecma International.
III. ES Specification Version History
-
ECMAScript 1 (June 1997): First version of specification
-
ECMAScript 2 (June 1998): To synchronize with ISO standard, introduced some small updates
-
ECMAScript 3 (December 1999): Added many core features such as regular expressions, string handling, control statements (
do-while,switch), exception handling (try-catch), etc. -
ECMAScript 4 (July 2008 abolished): Originally a large-scale upgrade (static types, modules, namespaces, etc.), but the span was too large, disagreements emerged, ultimately failed to gain adoption
-
ECMAScript 5 (December 2009): Not much change, added some standard library features and strict mode
-
ECMAScript 5.1 (June 2011): Another small update, to synchronize with ISO standard
-
[ECMAScript 6](/articles/es6 学习笔记 13 篇/) (June 2015): A wave of updates, realized many ideas from ES4 back then, and officially changed to naming specification versions by year
-
ECMAScript 2016 (June 2016): First annual version, compared to ES6, release cycle is shorter, new features are relatively fewer
-
ECMAScript 2017 (June 2017): Second annual version
-
Subsequent ECMAScript versions (ES2018, ES2019, ES2020, etc.) all officially approved in June
IV. TC39 Specification Development Process
From ES6 perspective, overly long release cycles had 2 problems:
-
Time span between versions is too long, features finalized early have to wait very long time, always waiting until specification officially releases (before being implemented and used), while later features often get finalized just before final release deadline,存在 risks
-
Design and implementation of language features are too far apart from usage, it's too late when design flaws are discovered during implementation and usage phases
For this, TC39 (ECMA International Organization Technical Committee No. 39) launched a new process:
P.S. ECMA International has many technical committees, besides TC39 ECMAScript, there are TC43 Universal 3D (U3D), TC45 Office Open XML Formats, etc., see Ecma template for minutes - Ecma International for details.
Main changes include:
-
ECMAScript features are designed independently, going through 5 stages, starting from Stage 0 (Strawman), through Stage 1 (Proposal), Stage 2 (Draft), Stage 3 (Candidate Proposal), finally ending at Stage 4 (Finished, Approved Proposal)
-
Requires prototype implementation and actual testing in later stages (handled by Test 262), to form feedback loop between design and implementation
-
ECMAScript releases one version per year, including all features that have entered Stage 4 before final release date
Therefore, starting from ES2016 (since new TC39 process implementation), the concept of ES versions has been greatly weakened. What needs concern is which stage the feature proposal is in. As long as it enters Stage 4, it's already considered a standard feature, and will be formally incorporated into standard in next June.
P.S. According to TC39 process document, release should be in July every year:
July: Approval of new standard by the ECMA General Assembly
But actual release time is June every year, possibly to commemorate those veteran versions released in June historically.
V. Backward Compatibility Principle
We find each ES specification version always remains fully compatible with all previous features. For example, ES6 proposed let, const but didn't remove var. This is because launching incompatible new versions would cause some problems:
-
JavaScript engines, IDEs, build tools would become bloated, because they need to support both old and new specification versions
-
Developers need to know differences between versions
-
Either migrate all existing code to new version, or (different projects) mix multiple versions, refactoring becomes very troublesome
-
Even need to mark version affiliation for each code segment, just like ES5 manually enabling strict mode. One reason it didn't become popular back then was adding directives at beginning of file or function is also troublesome
To avoid these problems, ES6 adopted a strategy called One JavaScript:
-
New versions always remain fully backward compatible (but occasionally there might be slight, unnoticeable cleanup)
-
Old features are not deleted or fixed, but better versions are introduced. For example,
letis improved version ofvar -
If certain aspects of language change, they only take effect within new syntax structures, i.e., implicitly selected. For example,
yieldis only a keyword withingenerator, all code in modules and classes defaults to strict mode
No comments yet. Be the first to share your thoughts.