!Re: proposal: Object Members

Waldemar Horwat waldemar at google.com
Mon Jul 30 22:35:38 UTC 2018


On 07/29/2018 04:37 PM, Isiah Meadows wrote:
> BTW, I came up with an alternate proposal for privacy altogether:
> https://github.com/tc39/proposal-class-fields/issues/115
> 
> TL;DR: private symbols that proxies can't see and that can't be enumerated.

Aside from syntax, the main semantic difference I see between this alternative and the main one is that this alternative defines private fields as expandos, creating opportunities for mischief by attaching them to unexpected objects.  Aside from privacy, one of the things the private fields proposal gives you is consistency among multiple private fields on the same object.  In the rare cases where you don't want that, you could use weak maps.

     Waldemar


More information about the es-discuss mailing list