Good-bye constructor functions?

Brendan Eich brendan at mozilla.com
Tue Jan 8 03:34:13 PST 2013


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?

> (and is given appropriate .prototype and [[Construct]]),

By mutation of the result of an evaluated expression?

> would you want to (otherwise, plain object is created for you).

What use-case?

> One of the options is you can specify that a function should represent 
> it:
>
>   class C {
>     static function(...args) { /* call behaviour */ };
>   }
>
> though you can of course put any expression there. Another good 
> candudate is {...} object literal. 

This is innovation beyond any cowpath or stable strawman we've promoted 
to Harmony in time for ES6. It goes beyond what we need, which Kevin 
pointed out succinctly: per-class @@call specialization.

/be


More information about the es-discuss mailing list