Good-bye constructor functions?

Brendan Eich brendan at
Tue Jan 8 04:46:59 PST 2013

Herby Vojčík wrote:
> Brendan Eich wrote:
>> Herby Vojčík wrote:
>>> In a few words, with class and constructor separated, you can specify
>>> what object should represent the class
>> Why? Where are the use-cases driving this, which goes beyond class as
>> constructor function that can be called as well as new'ed?
> This question is unfair: no one have "use cases" for this, when it was 
> not possible at all in the language.

Nothing's unfair about designing by use-cases, and that's how a lot of 
the Web standards roll. Notorious counter-examples have gone off the 
rails by doing otherwise, but I won't try to sum of the problems so 
simplistically. Nevertheless, we need use-cases, preferably ones already 
approximated by library code or transpilers.

> I'd ask the contrary*: what are the use case of tying class with its 
> own constructor function?

Designing means saying "no" and leaving things out (N. Wirth, IIRC). 
That's point #1.

JS already has the prototypal pattern with constructor function as 
"class", and that's what Harmony (now ES6) classes sugar. Point #2.

Stopping here. See my other reply on path dependency if you haven't yet.


More information about the es-discuss mailing list