Closed Bug 1499448 (es-fields) Opened 6 years ago Closed 5 years ago

Implement public instance fields proposal

Categories

(Core :: JavaScript Engine, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
Tracking Status
firefox65 --- wontfix
firefox66 --- wontfix

People

(Reporter: khyperia, Assigned: khyperia)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(3 files, 1 obsolete file)

This bug is to track implementation of the public and private instance fields proposal (currently stage 3): https://github.com/tc39/proposal-class-fields https://tc39.github.io/proposal-class-fields/
This new syntax should be added to jsfunfuzz. It should always trigger SyntaxErrors, for now.
Flags: needinfo?(nth10sd)
I'll endeavour to add the private identifier "#" once this lands.
Flags: needinfo?(nth10sd)
Gary, that's not all! There's also new syntax in classes to declare both public and private fields: class MyClass { field1 = "value1"; // <-- a public field #field2 = 12345; // <-- a private field field3; // <-- public field (initializer is optional, defaults to undefined) #field4 // <-- private field, no initializer, automatic semicolon insertion }
Thanks! That's helpful. I suppose both public fields and private fields are only applicable wrt. classes?
Keywords: checkin-needed
Pushed by aciure@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d0b577458d53 Implement syntax for public and private fields. r=jorendorff
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Priority: -- → P2
Notes for MDN writer's team: I've looked into our current documentation for this, and it looks like we have some mention of it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Field_declarations However, it could do with better documentation. I'm not sure it is worth documenting now. It doesn't seem to be supported anywhere yet (I could be wrong, but I did try testing it). I've therefore not added a note to the Fx65 rel notes. I'd recommend waiting until it is enabled by default in Fx, or at least until Chrome enables it.
Public class fields will be enabled by default in next stable version of Chrome in (Jan 29) https://v8.dev/blog/v8-release-72#public-class-fields
Neil Kakkar (https://developer.mozilla.org/en-US/profiles/neilkakkar) is currently writing the class fields documentation. If you have any suggestions for what can be improved about the current state, we'd love to hear it.
Attachment #9035998 - Attachment description: Bug 1499448: WIP patch for fields → Bug 1499448 - WIP patch for fields
Attachment #9035998 - Attachment description: Bug 1499448 - WIP patch for fields → Bug 1499448 - Implement more field functionality.
Attached file Bug 1499448 - Implement .initializers local variable. (obsolete) (deleted) —
Pushed by ahauck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/db4946736508 Implement more field functionality. r=jorendorff
Blocks: 1473796
Blocks: 1520996
Depends on: 1529758
Depends on: 1529772
Pushed by ahauck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/49fda807b7c5 Implement more field functionality. r=jorendorff

Ah, never cleared the needinfo, whoops. Found the issue and commented in the phabricator patch.

Flags: needinfo?(khyperia)
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED

This is becoming the meta bug for fields in JS; work should happen in bugs that block this.

Alias: es-fields
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Depends on: 1530832
Pushed by ahauck@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/70eb46335a2c Implement .initializers local variable. r=jorendorff
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Attachment #9044018 - Attachment is obsolete: true
Depends on: 1531285
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Backed out changeset 70eb46335a2c (bug 1499448) on request by jorendorff

Backout: https://hg.mozilla.org/integration/autoland/rev/c6197e7ad760cac9d691482130fa8ea72e7fd8de

Flags: needinfo?(jorendorff)
Flags: needinfo?(jorendorff)
Target Milestone: mozilla65 → ---
Depends on: 1532921
Depends on: 1534721
Depends on: 1535166
Depends on: 1535462
Depends on: 1535471
Depends on: 1540228
Depends on: 1540243
Depends on: 1540244
Depends on: 1540793
Depends on: 1540787
No longer depends on: 1540787
Depends on: 1541616
Depends on: 1541641
Depends on: 1540324
Depends on: 1542406
Depends on: 1542448
Type: defect → enhancement
Depends on: 1552022
Depends on: 1552229
Depends on: 1552875
Depends on: 1555037
Depends on: 1553744
Depends on: 1555464

We merged public instance fields! Woohoo!

Public static fields: bug 1535804
Private instance fields: bug 1562054

Status: REOPENED → RESOLVED
Closed: 6 years ago5 years ago
Resolution: --- → FIXED
Summary: Implement public and private instance fields proposal → Implement public instance fields proposal

We've updated docs for this when public fields were enabled in 69, see https://bugzilla.mozilla.org/show_bug.cgi?id=1555464#c15

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: