why not "new" instead of "constructor"?

Brendan Eich brendan at mozilla.com
Sat Nov 19 15:15:55 PST 2011


On Nov 19, 2011, at 3:14 PM, Brendan Eich wrote:

> That's the point: it's not just a method. It is a special form. In classes as proposed where the name was 'constructor', or if it's 'new' as in Dave's http://wiki.ecmascript.org/doku.php?id=strawman:minimal_classes proposal. It is not just another method that happens to have a catchy name.

See the desugaring in Dave's proposal for why, and consider how 'constructor' doesn't matter. We could call it 'snoopy' and there would still be special-ness to the form, extra semantics that any old method of a name other than the one we pick for the constructor would not have.

/be


More information about the es-discuss mailing list