-
Notifications
You must be signed in to change notification settings - Fork 27
Spec: Static private methods? #37
Comments
My intention was that removing the early error in https://tc39.github.io/proposal-static-class-features/#sec-static-semantics-early-errors would be sufficient. I believe the instance private methods grammar already supports static private methods, except for this error. |
I believe my misinterpretation was the result of confusion while navigating the multiple inter-connected specs. When I reviewed this: https://tc39.github.io/proposal-static-class-features/#sec-static-semantics-early-errors and saw there was no definition of PrivateBoundNames in that spec, I went to the "base" proposal-class-fields spec and found PrivateBoundNames, where I read:
So then I opened proposal-private-methods and did control-f for "PrivateBoundNames", which brought me directly to 1.2 Static Semantics: Early Errors, where I saw this:
At this point I'm not sure what happened... maybe I saw PropertyDefinition, but thought "PropertyName"? Would you mind adding an Editor's note to https://tc39.github.io/proposal-static-class-features/#sec-static-semantics-early-errors that clarifies the removal of this error "enables" static private methods? |
This text is really obscure; you're probably not the only one confused. Thanks for the recommendation. It can be hard for me to see which parts of my own text are hard to read. I've added the note you suggested. |
From README.md:
But the specification itself doesn't appear to include anything to support "Static private methods". The new grammar:
static
FieldDefinition [?Yield, ?Await];
Expands to:
FieldDefinition [Yield, Await] :
ClassElementName [?Yield, ?Await] Initializer [In, ~Yield, ~Await] opt
ClassElementName [Yield, Await] :
PropertyName [?Yield, ?Await]
PrivateName
PrivateName ::
#
IdentifierNameWhich means that a static private method cannot be produced by this grammar; only a static private field can be produced by the grammar defined in proposal-class-fields, with the addition made to the ClassElement production:
static
FieldDefinitionstatic
ClassElementName Initializerstatic
PrivateName Initializerstatic
#
IdentifierName InitializerThe text was updated successfully, but these errors were encountered: