On Mar 23, 2012, at 12:42 AM, Claus Reinke wrote:

> - would it make sense to name the constructor after the class
>   (avoiding 'constructor' and 'new')?

I was about to suggest exactly the same thing.

If I see a line of code saying
    let x = new FooBar();
and want to understand what it does, I'm instinctively looking for a function 
named FooBar, not one named either 'new' or 'constructor'.

Between 'new' and 'constructor', new seems like the better choice to me.  
Whilst it is true that prototypes currently contain a constructor property, I 
don't see a lot of code that explicitly accesses this.  In terms of the 
language actually actively in use in scripts by ES programmers, 'new' is 
currently in the common lexicon, and 'constructor' doesn't seem to be.  [ I 
make this statement on casual observation rather than any empirical evidence. 
:-) ]

cheers,
G.


_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to