3 ms·
Downvoting this comment because: 1. Afaik every single OO language allows this. I wouldn't know of prior art for the opposite behavior (only allowing access to
by jkrems 9y ago
Downvoting this comment because:
1. Afaik every single OO language allows this. I wouldn't know of prior art for the opposite behavior (only allowing access to the same object).
2. TypeScript works under different constraints and - for all intends and purposes - doesn't implement private properties when it comes to the final, running program. The reasons why TypeScript isn't a battle test solution are laid out pretty explicitly in the Github thread.
- RyanCavanaugh 9y agoThe only mainstream language I'm aware of (having looked into this before because someone complained about it re: TypeScript) that disallows cross-instance private access is Ruby.
- bcherny 9y ago> Afaik every single OO language allows this. Ruby and Scala disallow it, to name two (edit: to clarify, Scala supports both modes via private and private[this]). I stand corrected on Java, C#, and C++. > The reasons why TypeScript isn't a battle test solution are laid out pretty explicitly in the Github thread. I didn't see that, can you point me to it? Yes, in TS it's a compile-time-only check (as are all TS checks), but what does that have to do with reusing the same keyword for a runtime check?