let's assume a constructor than calls this.reset(...) method in the
process of initialization of an instance; and that, this method sets up lot
of object properties to set up initial state, including private ones using
private(this).foo = "bar"; kind of statements.
It seems to me there is a little quirk, but maybe it is a feature:
when there is at least one private x = ...; statement in the constructor
itself before the call to this.reset(...), everything works perfectly, even
undeclared private fields are set up fine;
when there is not such a statement, this.reset(...) fails? There is no
private variable record present.
That is, my question is, does private(this).foo = "bar"; create a private
variable record if it is not present?
Hi,
let's assume a constructor than calls `this.reset(...)` method in the
process of initialization of an instance; and that, this method sets up lot
of object properties to set up initial state, including private ones using
`private(this).foo = "bar";` kind of statements.
It seems to me there is a little quirk, but maybe it is a feature:
- when there is at least one `private x = ...;` statement in the constructor
itself before the call to this.reset(...), everything works perfectly, even
undeclared private fields are set up fine;
- when there is not such a statement, this.reset(...) fails? There is no
private variable record present.
That is, my question is, does `private(this).foo = "bar";` create a private
variable record if it is not present?
Herby
let's assume a constructor than calls
this.reset(...)
method in the process of initialization of an instance; and that, this method sets up lot of object properties to set up initial state, including private ones usingprivate(this).foo = "bar";
kind of statements.It seems to me there is a little quirk, but maybe it is a feature:
private x = ...;
statement in the constructor itself before the call to this.reset(...), everything works perfectly, even undeclared private fields are set up fine;That is, my question is, does
private(this).foo = "bar";
create a private variable record if it is not present?