prototype focus

Irakli Gozalishvili rfobic at gmail.com
Fri Jul 1 08:40:15 PDT 2011



On Friday, 2011-07-01 at 16:38 , Mark S. Miller wrote:

> On Fri, Jul 1, 2011 at 7:18 AM, Sean Eagan <seaneagan1 at gmail.com (mailto:seaneagan1 at gmail.com)> wrote:
> > On Fri, Jul 1, 2011 at 8:45 AM, Irakli Gozalishvili <rfobic at gmail.com (mailto:rfobic at gmail.com)> wrote:
> > 
> > > why do I have to create constructor function for all classes / subclasses ?
> 
> This magic trades confusion for convenience. In any earlier version of the proposal, I actually had a traditional default constructor, the equivalent of 
> 
>  constructor() { super(); }
> 
> but others argued against it. Sorry don't remember who. There were plenty of off list discussions to gather consensus. On this one, I didn't feel strongly either way, but I eventually agreed with the objectors. When in doubt, throw it out -- even more important in language design than in writing. 
> 
> > 
> > This could be handled by class literals by allowing for default
> >  constructors. If one doesn't provide a constructor, the following one
> >  could be provided:
> > 
> >  constructor(... args) {
> > super(... args);
> >  }
> 
> This one I object to because those used to other languages that provide such default constructors will only call the super constructor with no arguments. Though now that you mention it, I can see why JSers without exposure to other languages may naturally expect your's. 
> 
> 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 ? If not (which I think is the case) is another + in favor of prototype focus. 

> -- 
>  Cheers,
>  --MarkM

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


More information about the es-discuss mailing list