Re: EcmaScript Proposal – Private methods and fields proposals.
Waldemar Horwat
waldemar at google.com
Tue Apr 17 21:09:52 UTC 2018
On 04/17/2018 01:50 PM, Sultan wrote:
> >That would contradict your previous answer to the hijacking question.
>
> Can you point out the contradiction? The private field is still being written to by the providing class.
In the transpilation you created the field using
registry.set(this, {id: 0})
in the constructor. If you then claim that any write to the field can also create it, then you get the hijacking behavior which you wrote doesn't happen.
>>Class B is lexically nested inside class A. You want to refer to one of A's privates from within B's body.
>
> Can you provide an example of what this looks like with the current public/private fields proposals?
They just lexically scope the private names in their own separate namespace. #foo refers to the innermost enclosing class that has a private field called foo.
Waldemar
More information about the es-discuss
mailing list