proposal-class-fields icon indicating copy to clipboard operation
proposal-class-fields copied to clipboard

Documentation needed: Mechanics of how an inner class can access private names of the outer class is unclear

Open gsathya opened this issue 6 years ago • 4 comments

If I'm reading the spec correctly AllPrivateIdentifiersValid will validate correctly for the outer class but not for the inner class. Is this intended behavior or a spec bug?

gsathya avatar Jan 17 '19 20:01 gsathya

The valid set of private names inherits from the outer environment. See https://tc39.github.io/proposal-class-fields/#sec-all-private-identifiers-valid :

Let newNames be the concatenation of names with PrivateBoundIdentifiers of ClassBody.

Probably we should add a note in the spec to clarify, since you're not the first person to ask.

littledan avatar Jan 18 '19 14:01 littledan

PRs welcome to add this note! cc @tjcrowder

littledan avatar Jan 18 '19 14:01 littledan

@littledan - If no one gets there first, I've added it to my queue. I'll be working through queue items from Monday.

tjcrowder avatar Jan 18 '19 14:01 tjcrowder

You all are lucky you can work on such things, on a Monday. I have only short evenings and mostly weekends if I choose to voice any opinions on this sort of stuff, when I'm not working my regular job. It can cut into the limited time I have outside of work.

Please, don't rush specs, and try turning the hundreds of downvotes into upvotes.

trusktr avatar Apr 07 '19 21:04 trusktr