class Foo {}

Axel Rauschmayer axel at rauschma.de
Sun Jul 29 06:22:41 PDT 2012


On Jul 29, 2012, at 6:09 , Brendan Eich <brendan at mozilla.org> wrote:

> 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?).

I was wrong about Foo not being an instance of a Function. I meant class Foo {} could be equivalent to class Foo extends Object {} (which you mentioned below). Then Foo.[[Prototype]] would be Object.

> 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 {}".

Makes sense, thanks.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120729/217a198f/attachment-0001.html>


More information about the es-discuss mailing list