Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Add static private class field support #609

Merged
merged 1 commit into from
Jul 3, 2017

Conversation

jridgewell
Copy link
Member

Q A
Bug fix? no
Breaking change? no
New feature? yes
Deprecations? no
Spec compliancy? yes
Tests added/pass? yes
Fixed tickets
License MIT

Private class fields can be static (according to the unified proposal).

@xtuc
Copy link
Member

xtuc commented Jul 2, 2017

Nice job @jridgewell.

Do you think we could merge classProperties and classPrivateProperties plugins in Babylon? Since it just adds the static syntax.

@jridgewell
Copy link
Member Author

I'll do that in a second PR.

@diervo
Copy link
Contributor

diervo commented Jul 3, 2017

@xtuc @jridgewell
We should wait for merging both plugins until publicFields get to Stage3, which hopefully will happen in the next TC39 meeting (in about a month).

There is still some debate on the committee on wether this.#x will be required and so let's wait for the final version.

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;
}

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.

Copy link
Contributor

@diervo diervo Jul 3, 2017

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

@littledan
Copy link

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.

@diervo
Copy link
Contributor

diervo commented Jul 3, 2017

@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 this.#x syntax.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants