@@new
Erik Arvidsson
erik.arvidsson at gmail.com
Tue Jun 17 16:55:29 PDT 2014
On Jun 17, 2014 7:44 PM, "Brendan Eich" <brendan at mozilla.org> wrote:
>
> So far, I prefer your proposal to draft ES6 by a lot -- especially since
I missed the hideous Number special-casing spread around in the draft!
I don't.
How does this work with legacy classes?
function B() {
this.x = 1;
}
class C extends B {}
I just do not see how this solves any issues. As far as I can tell we will
still need to call the constructor after @@new is called. We need the two
phase initialization. One function for creating the instance and one to
initialize it.
>
> Jason Orendorff wrote:
>>>
>>> > Is `C === C[@@new]`?
>>
>>
>> Good question. I think calling `C(...args)` should be the same as
>> calling `new C(...args)`. How best to specify that, I'm not sure.
>
>
> Isn't the question of whether C(...args) is allowed as short for new
C(...args) a separable "option" from the rest of your proposal (and from
draft ES6)?
>
> I'd hate for your proposal to founder on this somewhat controversial
issue.
>
>
>> I don't think `C === C[@@new]` needs to be a goal,
>
>
> Should be specified not to be === in my view because:
>
>
>> it wouldn't
>> hold for regular functions, or for classes that don't define a
>> constructor (those inherit their @@new method from the base class), or
>> for classes that contain a `static [Symbol.new]()` method.
>
>
> See Allen's latest followup on this -- is it a static error to have both
constructor and the static [Symbol.new]() method?
>
>
>> But as an
>> implementation detail, if that's the easiest way to specify it, OK.
>
>
> See above. LMK if you disagree with anything, or anything's unclear.
Thanks again for writing up your counter-proposal!
>
> /be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140617/b3e3c6b3/attachment.html>
More information about the es-discuss
mailing list