a little `private` quirk
Herby Vojčík
herby at mailbox.sk
Wed Jan 4 23:43:29 PST 2012
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
More information about the es-discuss
mailing list