@@new

Brendan Eich brendan at mozilla.org
Wed Jun 18 11:09:10 PDT 2014


Allen Wirfs-Brock wrote:
> This is also one of my bigger concerns.  I think the rewriting and 
> reinterpretation of what the use wrote as a a constructor may be very 
> problematic.   For example,how does this get translated:
>
> class extends C {
>   constructor() {
>        super();
>        super.foo();  //apply the inherited foo method to the new object
>   }
> }
>
> If we had a design that didn't require the rewriting of the user 
> provided constructor I'd be much more comfortable.  Thinking...more 
> latter...

I used to think this way, but dherman pointed out years ago that 
constructor in ES6 class is a special form, even though it looks like a 
method. Here's an es-discuss thread from three years ago:

http://esdiscuss.org/topic/why-not-new-instead-of-constructor

/be


More information about the es-discuss mailing list