The class fields and private methods proposals can be accessed, manipulated or created by decorators. Some use cases:
A decorator can create a private field with initializers for underlying storage, with an initializer that runs as part of the constructor. The initializer can be taken from another field declaration. This pattern is used in the @tracked decorator.
A public accessor to a private field can be created, based on the name of a private field, like @readonly #foo.
A class decorator can easily "leak" all of the private names used in a class, e.g., to a testing framework. Doing the same thing with WeakMaps would require each one to be specifically exposed.
How do you see this proposal interacting with decorators?
The class fields and private methods proposals can be accessed, manipulated or created by decorators. Some use cases:
@tracked
decorator.@readonly #foo
.How do you see this proposal interacting with decorators?