Re:Public and private class fields
by lucideer on Thursday December 13, 2018 @12:54PM
(#18674383)
The justification is that they needed a unique accessor, because:
- attempting to access a non-existent private property using `this.prop` would create a public property "prop" in JS, which they claim would be a source of bugs.
- they also wanted to allow creating a public property on a subclass with the same name as a private property on a parent class—having the accessors the same could be confusing.
That said, they could still have had keywords for definition with an alternative accessor. # is definitely not idiomatic; it's extremely ugly.
- attempting to access a non-existent private property using `this.prop` would create a public property "prop" in JS, which they claim would be a source of bugs.
- they also wanted to allow creating a public property on a subclass with the same name as a private property on a parent class—having the accessors the same could be confusing.
That said, they could still have had keywords for definition with an alternative accessor. # is definitely not idiomatic; it's extremely ugly.