If we make call constructors static and inherited, then maybe the name call constructor becomes a bit odd.
-
The best alternative I could come up with is
static constructor:class Base { static constructor() { return new this(); } }
I like it because it fits nicely with the existing syntax; and it communicates clearly that
thisis the class thanks to thestatickeyword. -
If we're completely honest, a "constructor" is something that initializes a newly-created instance (
this), but our "static constructor" doesn't actually do that. So perhaps "constructor" is a mis-nomer. I'm looking for something along the lines ofstatic [[Call]]():// Not actually viable syntax, of course class Base { static [[Call]]() { return new this(); } }
I'm not actually suggesting this syntax. The terminology is better, but I can't come up with something that's syntatically acceptable. Maybe someone else has an idea?
But if not, I'm thinking
static constructorwould be pretty good.