13.2.2 [[Construct]], constructor, and [[Class]] (was __proto__)

liorean liorean at gmail.com
Sun Sep 23 11:39:01 PDT 2007


> > On 23/09/2007, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
> >> 2. (new function(){}).constructor should be Function.

> On Sep 23, 2007, at 8:59 AM, liorean wrote:
> > I agree. And in ES3 it is, unless the function either:

On 23/09/2007, Brendan Eich <brendan at mozilla.org> wrote:
> No:
>
> js> (new function(){}).constructor
> function () {
> }
> js> function C(){}
> js> new C().constructor
> function C() {
> }

Ah, my mistake there, was thinking of (function(){}).constructor for a
moment there.


> in no case is the value of (new function(){}).constructor Function.

Thinking about it with the new keyword in mind, I just realise that
what Garrett suggested makes no sense anyway - the function object is
the constructor. The function object is an instance of Function, but
the resulting object is an instance of the function object. Making the
object have Function as it's constructor property breaks the
prototype-constructor relationship.



> > On 23/09/2007, Garrett Smith <dhtmlkitchen at gmail.com> wrote:
> >> It appears that es4 ref impl has the correct result for instancof
> >> on primitives

> On Sep 23, 2007, at 8:59 AM, liorean wrote:
> > A bugfix, IIRC.

On 23/09/2007, Brendan Eich <brendan at mozilla.org> wrote:
> Incompatbile enough that we are not taking the chance -- we are
> changing this to match ES1-3, and to avoid boolean <: Boolean etc.

Sad to hear that, but I guess compatibility will have to rule here.
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list