private / protected class members
Opened this issue · 2 comments
In order to make an object property fully private. The closure method is not memory efficient, and not sure about JIT optimisations, but may be bad.
The symbol is a scope free way to index a private property on an object, the scope of the symbol instance beeing declared on the definition level and not a instanciation.
So real private is easy, but sharing protected symbols will be harder ... Question is still open.
The approach of typescript is different but not sure why
microsoft/TypeScript#13879
Take the same approach as TypeScript for protected values. For private values, as they are Class dependents, I'll find a way to avoid colisions between child/base classes (prefix with an arbitrary hash - low collision probability ?)