ECMA-262 ECMAScript® Language Specification

repository·main·Indexed 12 days ago

https://github.com/tc39/ecma262

The official source and current draft of the ECMA-262 ECMAScript Language Specification, used to generate the standard for developers worldwide. Includes the @tc39/ecma262-biblio package for machine-readable terms, clauses, grammar, and abstract operations.

Tokens
999
Snippets
4
Records
7
Agent score
97%

What's inside ECMAScript

  1. Understand why imported module bindings are aliased instead of copied

    main

    In ECMAScript modules, import statements create an alias to a remote binding rather than creating a new local copy. This design is critical for supporting cyclic module dependencies.

    If bindings were copied, a module involved in a cycle would receive a copy of an uninitialized value before the dependency has finished evaluating. By using aliases, the engine can create an empty binding first, allow the modules to finish loading, and then 'fill in' the value of that binding once the exporting module has been evaluated, ensuring the alias points to the correct, initialized value.

    // Even.js
    import {isOdd} from "./Odd.js";
    
    export function isEven(num) {
      if (num === 0) {
        return true;
      } else {
        return isOdd(num - 1);
      }
    }
    // Odd.js
    import {isEven} from "./Even.js";
    
    export function isOdd(num) {
      if (num === 0) {
        return false;
      } else {
        return isEven(num - 1);
      }
    }
    // main.js
    import {isOdd} from "./Odd";
    
    isOdd(2);
  2. Why import statements do not use destructuring syntax

    main
    While import statements look similar to destructuring, they do not use real destructuring syntax because they create an alias of a remote binding rather than creating new local bindings. First-class destructuring is designed to create new bindings from substructures of objects or arrays, which is fundamentally different from the aliasing mechanism required by the module system.
  3. Propose a new ECMAScript feature

    main
    New features must be proposed to the TC39 committee and championed (or co-championed) by at least one committee member. Once raised at a committee meeting, the proposal enters Stage 0. For detailed information on the progression through stages, refer to the official proposal process documentation.
  4. View the human-readable ECMAScript specification

    main

    The source code in this repository is processed into a human-readable version of the ECMA-262 Language Specification. You can view the current draft online at the official TC39 website.

    https://tc39.es/ecma262/
  5. Install and use @tc39/ecma262-biblio with ecmarkup

    main

    The @tc39/ecma262-biblio package provides a machine-readable representation of ECMA-262 terms, clauses, grammar, and abstract operations. If you are using ecmarkup and want to load this bibliography, add it as a dependency to your project and use the --load-biblio flag.

    Warning: This package is inherently unstable because it is updated alongside the specification. Editorial changes in ECMA-262 can modify the bibliography, potentially breaking builds (especially when using --lint-spec --strict). To prevent unexpected breakage, you should pin a precise version of this package rather than relying on semver ranges.

    # Example usage with ecmarkup
    ecmarkup --load-biblio @tc39/ecma262-biblio <other-flags>
  6. Set up the specification development environment

    main

    To build the specification from source, follow these steps after cloning the repository:

    1. Install dependencies: npm install
    2. Build the spec: npm run build
    3. (Optional) Set up continuous builds: npm run watch

    The build output is located in the out directory. To remove the build artifacts, run npm run clean.

    npm install
    npm run build
    # or for continuous builds
    npm run watch
    # to clean output
    npm run clean