Protected and friend access modifier for class members

JavaScript does not have access levels - something is either reachable/public or unreachable/private.

“protected’ doesn’t make sense in the language without a way to limit access to things that’s different from lexical scope, and that doesn’t require circular dependencies. The challenge for this concept isn’t the syntax or keyword used to denote it; it’s “what could the semantics possibly be”? I remain convinced that it’s not achievable in an ergonomic way.

3 Likes