Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private slot declarations need to be in constructor scope #11

Closed
erights opened this issue Feb 28, 2016 · 1 comment
Closed

Private slot declarations need to be in constructor scope #11

erights opened this issue Feb 28, 2016 · 1 comment

Comments

@erights
Copy link

erights commented Feb 28, 2016

tc39/proposal-class-public-fields#2 and tc39/proposal-private-fields#25 apply here as well. Notice the existing notational redundancy in examples such as

class {
  private #data1;
  constructor(d) {
    #data1 = d; 
  }
}

If this is written instead as

class {
  constructor(d) {
    private #data1 = d; 
  }
}

then this line would be all that is necessary to declare and initialize this private slot in a data-dependent way. As with tc39/proposal-class-public-fields#2 and tc39/proposal-private-fields#25 , this would smoothly accommodate future support for const private slots, which must be initialized and cannot be assigned.

@erights erights changed the title Private field declarations need to be in constructor scope Private slot declarations need to be in constructor scope Feb 28, 2016
@erights
Copy link
Author

erights commented May 2, 2016

Closing for the same reasons that closed tc39/proposal-private-fields#25 and tc39/proposal-class-public-fields#2

@erights erights closed this as completed May 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant