why not "new" instead of "constructor"?

Axel Rauschmayer axel at rauschma.de
Sat Nov 19 14:58:33 PST 2011

>> I like the idea of replacing the method name “constructor” with something better, but “new” suggests instantiation *and* initialization to me. Is “init” a possibility?
> Who said anything about "replacing"?
> If we are trying to match or sugar the prototypal pattern, then whatever the constructor name or keyword in the syntax, there must be for class C a back-link C.prototype.constructor.

I only meant replacing in as far as the method that was previously called “constructor” is now called “new” in Allen’s example:

let Point = class {
   x: 0,  //not really needed unless defining an object exemplar 
   y: 0, 
   new(x,y) {
      this.x = x;

Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

More information about the es-discuss mailing list