-
-
Notifications
You must be signed in to change notification settings - Fork 255
Add static private class field support #609
Conversation
Nice job @jridgewell. Do you think we could merge classProperties and classPrivateProperties plugins in Babylon? Since it just adds the static syntax. |
I'll do that in a second PR. |
@xtuc @jridgewell There is still some debate on the committee on wether Decorators might be another moving piece that is very intertwined, but I guess semantics are kind of stable? so its mostly implementation details from a babylon point of view. Lastly, just an FYI I think @littledan wants to present private methods, so let's see which Stage that lands... :) |
class A { | ||
static #x; | ||
static #y = 1; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have comma-separated field declarations landed yet? If so, it'd be nice to have tests that demonstrate that you can mix static public and private field declarations in a comma-separated list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR is pending to be merged: #608
This looks great. I don't see why it should wait until Stage 3 to land--I presented static private fields to the committee in the May meeting with this syntax and didn't hear any concerns. I think @hzoo is doing a lot of work to communicate to users that Stage 2 proposals are unstable. For decorators, we unfortunately don't have spec text yet which combines it with fields; hope to fix that soon. Private methods haven't been presented yet, so I guess they will wait a bit longer to add to Babel. |
@littledan I was not talking about this PR, this is good to go, the refactor to combine public/private fields is what Im saying to postpone til we figure out the |
Private class fields can be static (according to the unified proposal).