Re: EcmaScript Proposal – Private methods and fields proposals.

Isiah Meadows isiahmeadows at gmail.com
Thu Apr 12 21:13:19 UTC 2018


This is already being worked on:

- Instance private fields/methods: https://github.com/tc39/proposal-class-fields
- Static private fields/methods:
https://github.com/tc39/proposal-static-class-features/
- Recent TC39 meeting:
https://esdiscuss.org/notes/2018-03-21#10ivb-javascript-classes-11

-----

Isiah Meadows
me at isiahmeadows.com

Looking for web consulting? Or a new website?
Send me an email and we can get started.
www.isiahmeadows.com


On Thu, Apr 12, 2018 at 2:11 PM, Sultan <thysultan at gmail.com> wrote:
> [Strawman] Private methods and fields for JavaScript:
> https://github.com/thysultan/proposal-private-methods-and-fields
>
> ```js
>
> class A {
>   private id = Symbol('unique')
>   equal(instance, property) {
>     return private(this)[property] == private(instance)[property]
>   }
> }
>
> const x = new A()
>
> x.equal(x, 'id')
>
> ```
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>


More information about the es-discuss mailing list