extending an ES6 class using ES5 syntax?

Jason Orendorff jason.orendorff at gmail.com
Tue May 17 18:22:49 UTC 2016


True. We have some special cases w.r.t. object literals, and I've
thought about optimizing `__proto__:` in particular. There's no
fundamental reason we couldn't do it, but so far the syntax does not
seem to be common enough to pay for it.

-j

On Mon, May 16, 2016 at 2:20 PM, Allen Wirfs-Brock
<allen at wirfs-brock.com> wrote:
>
>> On May 16, 2016, at 10:31 AM, Jason Orendorff <jason.orendorff at gmail.com> wrote:
>>
>> ...
>> `B.prototype = Object.create(A.prototype)` is less of a problem, for
>> our implementation, because objects created by constructor B later get
>> a prototype chain where every object is clean (none of them have ever
>> had their [[Prototype]] changed; so no assumptions have been
>> invalidated).
>>
>
> Jason,
>
> Do you or have you considered special casing __proto__ used in object literals:
>
> ```js
>
> let p = {
>    __proto__: Array.prototype,
>    m1 () {…},
>    m2 () {…}
> };
> ```
>
> Lots of good declarative shape information in that form.
>
> Allen
>
>


More information about the es-discuss mailing list