new instantiation design alternatives

Allen Wirfs-Brock allen at
Thu Sep 11 14:15:08 PDT 2014

On Sep 11, 2014, at 1:37 PM, Jason Orendorff wrote:

> It seems like new^ is a new argument that is implicitly passed to all functions.
> What does new^ mean in an arrow function?
> How does new^ interact with a proxy whose target is a constructor?

`new^`  has the value of the receiver argument to the [[Construct[[ internal method. This is a parameter newly added to [[Construct]].  Normally it is set to the the value that `new` is applied to.  But for `new super` calls it is set to the current `new^` value. In that regard it is like the "receiver" parameter to [[Get]] and [[Set]]. If a constructor is invoked via [[Call]]  `new^` has the value `undefined`.  that's how you can test for "called as a function" vs. "called as a constructor".

`new^` is lexically scoped, just this `this` and `super`.  If an arrow function references `new^` it is the value of the closest lexically enclosing constructor function (a function that implements [[Construct]]).

Just like [[Get]] and [[Set]], the trap for [[Construct]] is extended to include a "receiver" parameter.


> -j
> On Thu, Sep 11, 2014 at 3:00 PM, Allen Wirfs-Brock
> <allen at> wrote:
>> oh oops!  they are supposed to be "new^".  Will fix...
>> On Sep 11, 2014, at 12:55 PM, Boris Zbarsky wrote:
>>> On 9/11/14, 12:35 PM, Allen Wirfs-Brock wrote:
>>>>  summaries the
>>>> main syntactic changes since the meeting and provides rationales them.
>>>> These features are common  to both alternates.  this is a good place to
>>>> start, after reading the meeting notes.
>>> Allen, thanks for putting this together!
>>> I have a question: what do the uses of "this^" in this document mean? Are those meant to be "new^"?
>>> -Boris
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list