class Foo {}

Brendan Eich brendan at mozilla.org
Sat Jul 28 21:09:08 PDT 2012


Axel Rauschmayer wrote:
> A case could be made that Foo.[[prototype]] should be Object and not 
> Function.prototype. Then the prototype hierarchies of classes and 
> their prototypes would be fully symmetric. The reason that isn’t done 
> is so that a class is an instance of Function, right?

Yes, the class name binds to the constructor, which is a function. So 
there is no way that Foo.[[Prototype]] could be Object.prototype (is 
that what you meant?).

As for Object, that's ruled out for "class Foo {}" by design, to avoid 
class-side delegation polluting Foo with create, 
getOwnPropertyDescriptor, etc. If you want those, you have to say so: 
"class Foo extends Object {}".

/be


More information about the es-discuss mailing list