Prototypes as the new class declaration

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Jun 20 02:16:13 PDT 2011


just catching up after 2+ days of no net access...

On Jun 20, 2011, at 5:14 AM, Brendan Eich wrote:

> On Jun 19, 2011, at 9:23 AM, Axel Rauschmayer wrote:
> 
> 
> 
>> 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.

correct, too much magic


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

correct, whatever magic there is occurs as part of defining a "constructor" property as part of an object literal.  However, such things could still be wired up manually (most likely by somebody wanting to create procedural abstractions for class-like definitions.


Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110620/3c4c687b/attachment.html>


More information about the es-discuss mailing list