Hello,

the current class proposal (as I read it) specifies that the private block is created by first 'private foo[ = "bar"];' in the constructor. The question is, what is constructor does not contain any private declarations, but uses private, like this:

class Coutner {
 constructor () {
   this.reset();
 }

 increment () {
   private(this).c++;
 }

 reset () {
   private(this).c = 0;
 }

 get count () {
   return private(this).c;
 }
}

The reset method is part of the API. Conveniently, it resets the state of the object to the initial state, so constructor is calling it. The question is: does private(this) create the private storage block in this case?

Herby
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to