Closed Bug 1540228 Opened 6 years ago Closed 5 years ago

Implement ES public static fields

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1535804

People

(Reporter: jorendorff, Unassigned)

References

Details

The public static fields part of this proposal:

https://github.com/tc39/proposal-static-class-features/

(It also proposes static private fields and methods, but I'll file that separately later. We want to finish public static fields first.)

Details:

  • As with non-static fields, the initializer is optional.
  • Each initializer is evaluated once, in a separate pass over the ClassMembers.
    • It happens after all computed property names are computed.
    • It happens after the constructor and prototype objects are created and otherwise completely populated.
    • It happens after the inner binding for the class name is initialized, so initializers can use that identifier to refer to the constructor.
    • It happens before the outer binding for the class name is initialized.
  • The spec is just DefineField(constructor, field), as opposed to DefineField(instance, field) for non-static fields).
    • Initializers are technically lambdas, just like regular fields.
    • this can be used in an initializer, and its value is the constructor.
    • The fields themselves are just properties defined on the constructor.
    • They're writeable, configurable, and enumerable.

We probably don't want to block the rest of public fields on this, but it seems doable. Maybe two separate prefs, just for minimum risk to (nonstatic) fields.

Priority: -- → P2

Arbitrary choice in which one is a duplicate, idk. (This one blocks bug 1499448, the other one is blocked by bug 1499448)

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.