Kagami Rosylight (2016-09-27T04:10:17.000Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```
class A {
  foo() {
    return "foo"
 }
}

class B extends A {
}

partial(B, class {
  foobar() {
    return `${super.foo()}bar`;
  }
})

output.value = new B().foobar(); // will be “foobar;
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/

Sent from Mail for Windows 10

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160927/d359e790/attachment.html>
saschanaz at outlook.com (2016-09-28T05:21:28.617Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
    return "foo"
  }
}

class B extends A {
  bar() {
    return "bar";
  }
}

partial(B, class {
  foobar() {
    return `${super.foo()}${this.bar()}`;
  }
})

output.value = new B().foobar(); // will be "foobar";
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/saschanaz/jcfp53h2/
saschanaz at outlook.com (2016-09-28T05:20:40.208Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
  	return "foo"
  }
}

class B extends A {
  bar() {
    return "bar";
  }
}

partial(B, class {
  foobar() {
    return `${super.foo()}${this.bar()}`;
  }
})

output.value = new B().foobar(); // will be "foobar";
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/2/
saschanaz at outlook.com (2016-09-28T00:02:07.869Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
    return "foo"
  }
}

class B extends A {
}

partial(B, class {
  foobar() {
    return `${super.foo()}bar`;
  }
})

output.value = new B().foobar(); // will be "foobar";
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/
saschanaz at outlook.com (2016-09-27T04:18:21.393Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
    return "foo"
 }
}

class B extends A {
}

partial(B, class {
  foobar() {
    return `${super.foo()}bar`;
  }
})

output.value = new B().foobar(); // will be "foobar";
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/
saschanaz at outlook.com (2016-09-27T04:14:02.682Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
    return "foo"
 }
}

class B extends A {
}

partial(B, class {
  foobar() {
    return `${super.foo()}bar`;
  }
})

output.value = new B().foobar(); // will be “foobar;
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/
saschanaz at outlook.com (2016-09-27T04:13:22.314Z)
I’m not sure it’s okay to reply on this very old thread, but if I’m understanding correctly the desugared code can be fairly short with new Object.getOwnPropertyDescriptors:

```js
function partial(base, extension) {
  extension.prototype.__proto__ = base.prototype.__proto__; // to enable 'super' reference
  const descriptors = Object.getOwnPropertyDescriptors(extension.prototype);
  delete descriptors.constructor; // must not override constructor
  Object.defineProperties(base.prototype, descriptors);
  
  return base;
}
```

```js
class A {
  foo() {
    return "foo"
 }
}

class B extends A {
}

partial(B, class {
  foobar() {
    return `${super.foo()}bar`;
  }
})

output.value = new B().foobar(); // will be “foobar;
```

This sample currently only works on Firefox 50+. https://jsfiddle.net/v8bbvavv/

Sent from Mail for Windows 10