Prototypes as the new class declaration

Brendan Eich brendan at mozilla.com
Sun Jun 19 21:14:26 PDT 2011


On Jun 19, 2011, at 9:23 AM, Axel Rauschmayer wrote:

>>> Where would the prototype of the new instance come from? Would SkinnedMesh.constructor.prototype point to SkinnedMesh?
>> 
>> Of course -- Allen's proposal just "rotates" the (constructor, prototype) pair so the named or "outer" object is the prototype.
> 
> 
> The only thing I don’t understand is how/where the assignment
>    SkinnedMesh.constructor.prototype = SkinnedMesh
> is made.

Good point, sorry for missing it.


> Would Allen’s proposal change the language so that whenever a function f is assigned to the property "constructor" of an object o, there is the following assignment?
>    f.prototype = o

I don't think so, that's too broad and incompatible.


> I have no trouble understanding that everything (modulo builtins) works fine if the above assignment is made *somewhere*.

It seems to me it would occur when in an ObjectLiteral where a function expression is assigned as the initial value of a 'constructor'-named PropertyAssignment.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110619/27884dba/attachment-0001.html>


More information about the es-discuss mailing list