On Jun 18, 2014, at 1:43 PM, Brendan Eich wrote:
> Allen Wirfs-Brock wrote:
>>> Not so much to me, and one could argue for static [@@new](){} sugar
>>> similarly.
>>
>> I think that fact that these really are semantically equivalent:
>>
>> function F(x) {this.foo=x};
>> class F {constructor(x) {this.foo=x}};
>>
>> is pretty important to the evolutionary nature ES6 classes.
>
> Jason covered the combinations: his proposal supports class subclassing
> function, etc. What concretely do you mean here, if not that? If you mean
> refactoring from one to the other, what observably differs?
My understanding of the proposal was that:
class F {constructor(x) {this.foo=x}};
turns into the equivalent of:
function F(x) { /* ??? the initial message really isn't explicit about what
does here */ };
F[Symbol.new] = {[Symbol.new](x) { //use an object literal to create a
"method" kind of function
var obj = super();
obj.foo = x
}}[Symbol.new].toMethod(F);
which is quite different from you get for:
function F(x) {this.foo=x};
allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss