-
Notifications
You must be signed in to change notification settings - Fork 12.8k
true private members & symbols ? #13879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
BTW, I've read all thread on Stackoverflow http://stackoverflow.com/questions/12713659/typescript-private-members and Codeplex https://typescript.codeplex.com/discussions/397651 but they don't speak about symbols so maybe they are too old as symbols were introduced lately. |
We once got a PR from @Arnavion (see #684), however, the emit has some issues. At the time, @NoelAbrahams noted:
Things might have changed in terms of speed, but at this point I'd rather we didn't change our |
Many thanks, it's very helpfull all these links. Finger crossed for private slots, anyway they already reserved the private keyword http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words |
Seems no longer to be true, property access is 2% slower and instanciation performance is equal for me (Chrome 56). By the private slot proposal, do you mean the tc39 proposal-private-fields? |
Sadly, symbols will not be a guarantee to make things fully private : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertySymbols Not tested yet, but seems obviously slow, is to use : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap |
Hi,
Is there any reason you don't use symbols for private properties on classes ? I'm really interested on what you have done with typescript and try something similar so I'm maybe missing something.
Best Regards,
Ioan
The text was updated successfully, but these errors were encountered: