Good call, however, it wouldn't work so well with constructor because
`Object.setPrototypeOf(B, A)` is still neede here, and also trashing
initial `B.prototype` with an all enumerable assignment still wouldn't
solve this case.
```js
B.prototype = {
__proto__: A.prototype,
constructor: B, // now enumerable
method() {
// also enumerable
}
};
```
Maybe having a special case for "classes", the only place where prototype
is usually modified, would solve them all?
On Mon, May 16, 2016 at 8:20 PM, Allen Wirfs-Brock <[email protected]>
wrote:
>
> > On May 16, 2016, at 10:31 AM, Jason Orendorff <[email protected]>
> 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
>
>
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss