Re: EcmaScript Proposal – Private methods and fields proposals.

Michael Theriot michael.lee.theriot at gmail.com
Fri Apr 13 13:48:07 UTC 2018


This matches my initial perceptions of private properties in JS; exactly identical to regular properties but private, which I have not seen preserved in the other proposals.

> On Apr 13, 2018, at 4:38 AM, Sultan <thysultan at gmail.com> wrote:
> 
> 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> wrote:
>> 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?
>> 
>>     Waldemar
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180413/81e7d7cb/attachment.html>


More information about the es-discuss mailing list