Re: Destructuring instances with private fields

2018-09-07 Thread Ranando King
I can make it work work under my proposal-object-members by making '#' a postfix unary operator, but then it would have to be a syntax error to use it that way unless we're dealing with a destructuring operation. That just opens up too many ways to abuse it and leak the private container. So

Re: Destructuring instances with private fields

2018-09-06 Thread Isiah Meadows
BTW, this just falls out of the grid with my private symbols suggestion https://github.com/tc39/proposal-class-fields/issues/115 On Thu, Sep 6, 2018 at 10:14 Ranando King wrote: > I can understand why this would be wanted. It would save some excess > typing. However, doesn't it also lead to

Re: Destructuring instances with private fields

2018-09-06 Thread Ranando King
I can understand why this would be wanted. It would save some excess typing. However, doesn't it also lead to the potential foot-gun of forgetting to assign any modifications back to the original private field? Also, since private fields aren't actually own properties of the instance, how could

Destructuring instances with private fields

2018-09-05 Thread kdex
Often times, when I use a class field a lot, I create a local binding for it, so that I don't have to prefix every appearance with `this.`: ```js class Foo { bar = 1; method() { const { bar } = this; /* … */ } } ``` The same approach would