Does private(expr) create a private storage block?

Herby Vojčík herby at
Mon Jan 9 08:33:21 PST 2012


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 () {

  increment () {

  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 


More information about the es-discuss mailing list