Getting back to the "new" vs. "constructor" issue:

The only real practical benefit to using "constructor" is that, if we use
"new", it makes it a little bit harder to create a method named "new":

    class C {
      constructor() {}
      new() {}
    }

    // vs

    class C {
      new() {}
      "new"() {}
    }

Otherwise (per Dave's suggestions) they are equivalent.

Since

1)  The whole point of classes is to provide syntactic sugar for what is
already possible in the language, and

2)  There will be far more constructors (no matter how they are spelled)
than "new" methods, and

3)  It would be rather bizarre to have a "new" method on a class instance
anyway, and

4)  "constructor" is positively cringe-worthy  : )

I conclude that on balance, we will get more benefit from using "new" than
from using "constructor".

Of course, I would be happy to use either one (ever-so-slight cringing
notwithstanding).  ; )

kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to