Re:JavaScript TC39 implementing hashmark private class fields
by bcherny on Thursday August 03, 2017 @04:06PM
(#14923301)
> 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?
Re:JavaScript TC39 implementing hashmark private class fields
by RyanCavanaugh on Thursday August 03, 2017 @03:51PM
(#14923143)
The 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.
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.