Re: EcmaScript Proposal – Private methods and fields proposals.
thysultan at gmail.com
Fri Apr 13 08:38:38 UTC 2018
The proposal is an explainer with regards to an alternative sigil-less
syntax to back private fields/methods.
>What does private(this)[property] do?
"private(this)[property]" and alternatively "private[property]" or
"private.property" all invoke access of a private "property" on the "this"
instance of the class, symmetrical to the syntax/function nature of both
the "super" and "import" keywords.
>How do private fields come into existence?
Unless i've misunderstood what is meant by "come into existence" the
proposals makes use of the reserved "private" keyword to define private
fields i.e "private id = 1".
>What's private about private fields?
Outside of a private fields provider class, private fields/methods would
not be accessible.
>How do you prevent them from being forged or stuck onto unrelated objects?
What do you mean by this?
On Fri, Apr 13, 2018 at 1:16 AM, Waldemar Horwat <waldemar at google.com>
> I read that proposal but don't understand what the proposal actually is.
> At this point it's a bit of syntax with no semantics behind it. What does
> private(this)[property] do? How do private fields come into existence?
> How do you prevent them from being forged or stuck onto unrelated objects?
> What's private about private fields?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss