森建 (2016-01-19T13:16:07.000Z)
moriken at kimamass.com (2016-01-19T13:29:14.273Z)
@Thomas >Could this be achieved with decorators? I want to get Syntax Sugar. But I didn't have an idea using decorators, thank you! @kdex >About your nomenclature: Why name it `protected` rather than `private`? Am I missing a key difference between the two here? This is not `private` proposal, because `class B extends A` can call `getName()` in `class Protected_A`, like below. ```js class B extends A { constructor(name, lastName, age) { super(name, lastName); // protected this if(new.target === B) _(this, Protected_B); // protected property _(this).age = age; } callGetAge() { return _(this).getAge(); } // added getData() { return { name: _(this).getName(); // Protected_A age: _(this).getAge(); } } } ``` I'm sorry that my JavaScript code in ES2015 is too vain complex to understand. @Andrea Giammarchi >On a side note, that `Object.assign` operation doesn't do what you think it does, there are better patterns (boilerplates, actually ...) to copy own properties over within their descriptors, if different from enumerable data descriptors. I didn't know boilerplates, thank you! But `Object.assign` enable to copy accessors by using `Object.getOwnPropertyDescriptor` according to [MDN sample code](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign). Of course, this approach must be bad... Note: In case, `Object.getOwnPropertyDescriptors` proposal (Stage 0) in ES2016 isn't same as `Object.getOwnPropertyDescriptor`. I misunderstood it. >P.S. the amount of wm.set(a, b).get(a) operations instead of wm.set(a, b) returning b is too damn high ... I know, I know, old discussion is old (and too late anyway) Sorry, it's my corner-cutting. I didn't know the amount, thank you!
moriken at kimamass.com (2016-01-19T13:21:13.522Z)
@Thomas >Could this be achieved with decorators? I want to get Syntax Sugar. But I didn't have an idea using decorators, thank you! @kdex >About your nomenclature: Why name it `protected` rather than `private`? Am I missing a key difference between the two here? This is not `private` proposal, because `class B extends A` can call `getName()` in `class Protected_A`, like below. ```js class B extends A { constructor(name, lastName, age) { super(name, lastName); // protected this if(new.target === B) _(this, Protected_B); // protected property _(this).age = age; } callGetAge() { return _(this).getAge(); } // added getData() { return { name: _(this).getName(); // Protected_A age: _(this).getAge(); } } } ``` I'm sorry that my JavaScript code in ES2015 is too vain complex to understand. @Andrea Giammarchi >On a side note, that `Object.assign` operation doesn't do what you think it does, there are better patterns (boilerplates, actually ...) to copy own properties over within their descriptors, if different from enumerable data descriptors. I didn't know boilerplates, thank you! But `Object.assign` enable to copy accessors by using `Object.getOwnPropertyDescriptor` according to [MDN sample code](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign). Of course, this approach must be bad... Note: In case, `Object.getOwnPropertyDescriptors` proposal (Stage 0) in ES2016 isn't same as `Object.getOwnPropertyDescriptor`. I misunderstood it. >P.S. the amount of wm.set(a, b).get(a) operations instead of wm.set(a, b) returning b is too damn high ... I know, I know, old discussion is old (and too late anyway) Sorry, it's my corner-cutting. I didn't know the amount, thank you!
moriken at kimamass.com (2016-01-19T13:19:41.513Z)
@Thomas >Could this be achieved with decorators? I want to get Syntax Sugar. But I didn't have an idea using decorators, thank you! @kdex >About your nomenclature: Why name it `protected` rather than `private`? Am I missing a key difference between the two here? This is not `private` proposal, because `class B extends A` can call `getName()` in `class Protected_A`, like below. ```js class B extends A { constructor(name, lastName, age) { super(name, lastName); // protected this if(new.target === B) _(this, Protected_B); // protected property _(this).age = age; } callGetAge() { return _(this).getAge(); } // added getData() { return { name: _(this).getName(); // Protected_A age: _(this).getAge(); } } } ``` I'm sorry that my JavaScript code in ES2015 is too vain complex to understand. @Andrea Giammarchi >On a side note, that `Object.assign` operation doesn't do what you think it does, there are better patterns (boilerplates, actually ...) to copy own properties over within their descriptors, if different from enumerable data descriptors. I didn't know boilerplates, thank you! But `Object.assign` enable to copy accessors by using `Object.getOwnPropertyDescriptor` according to [MDN sample code](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign). Of course, this approach must be bad... Note: In case, `Object.getOwnPropertyDescriptors` proposal (Stage 0) in ES2016 isn't same as `Object.getOwnPropertyDescriptor`. I misunderstood it. >P.S. the amount of wm.set(a, b).get(a) operations instead of wm.set(a, b) returning b is too damn high ... I know, I know, old discussion is old (and too late anyway) Sorry, it's my corner-cutting. I didn't know the amount, thank you!