You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since class is syntactic sugar for function and "special" "prototype" property (at least class constructors are defined in terms of function and "prototype"), I feel like it's better to tie private fields to those constructs. In other words, one should be able to achieve exactly same results with function and prototype as with a class.
Currently this proposal adds PrivateFieldEnvironment to Execution Contexts and the only defined way to create new PrivateFieldEnvironment is ClassDefinitionEvaluation (that is evaluation of a class ... expression).
This will result in that whenever user wants to create on object with truly private fields, they will have to use a dummy class declaration with all it's limitation (like inability to declare arbitrary class members in runtime in reflective manner (without eval-like features)).
I propose that at least
a way of creating a new PrivateFieldEnvironment and a way of defining new PrivateFieldIdentifers in that environment in reflective manner are defined
Since class is syntactic sugar for function and "special"
"prototype"property (at least class constructors are defined in terms of function and "prototype"), I feel like it's better to tie private fields to those constructs. In other words, one should be able to achieve exactly same results with function and prototype as with a class.Currently this proposal adds PrivateFieldEnvironment to Execution Contexts and the only defined way to create new PrivateFieldEnvironment is ClassDefinitionEvaluation (that is evaluation of a
class ...expression).This will result in that whenever user wants to create on object with truly private fields, they will have to use a dummy
classdeclaration with all it's limitation (like inability to declare arbitrary class members in runtime in reflective manner (withouteval-like features)).I propose that at least
Object.createEDIT: The
Object.createpart has been revised as unnecessary later in this thread.