@@new

Brendan Eich brendan at mozilla.org
Tue Jun 17 16:44:10 PDT 2014


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!

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


More information about the es-discuss mailing list