prototype focus

Brendan Eich brendan at mozilla.com
Fri Jul 1 14:51:53 PDT 2011


On Jul 1, 2011, at 8:40 AM, Irakli Gozalishvili wrote:
> On Friday, 2011-07-01 at 16:38 , Mark S. Miller wrote:
> 
>> With two expectations for the semantics of something that does not appear in the code, and without a static or dynamic rejection to prevent progress of the code written to the wrong assumption, I now finally feel strongly about this. The critics were right -- we should not provide any default constructor. Thanks for pointing out the problem case.
>>  
> 
> Do you think prototype focused version:
> 
>  Prototype.new(foo);
> 
> also suggest wrong assumptions ?

What's the constructor protocol here? If I don't implement Prototype.new or Prototype.constructor, then what in the super-prototype is called, with what arguments?


> If not (which I think is the case) is another + in favor of prototype focus. 

This scoring is silly. The trouble with OOP default-constructor protocols is there are so many of them. Having none, as Mark points out, avoids trouble. Having a different one from any in the language as conventionally used (including built-ins, DOM, etc.), even with prototype focus, does not guarantee anything.

As Axel has acknowledged, any .new protocol will coexist with constructor.prototype, forever. Adding explicit super-constructor calling is part of the classes deal, whatever the focus (constructor or prototype). Defaulting the super-constructor call or even the constructor implementation is trouble.

/be

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110701/1ab1be96/attachment.html>


More information about the es-discuss mailing list