13.2.2 [[Construct]], constructor, and [[Class]] (was __proto__)
P T Withington
ptw at pobox.com
Mon Sep 24 05:04:41 PDT 2007
On 2007-09-23, at 14:14 EDT, Brendan Eich wrote:
> On Sep 23, 2007, at 8:59 AM, liorean wrote:
>
>>> 1. The constructor property should be on the object instance
>>> *created*
>>> by the function.
>>
>> That argument I agree with. It should be on the instance and not
>> the prototype.
>
> The reason for the original prototype-owned constructor was to afford
> a back-pointer from prototype to constructor function without
> imposing a per-instance property (which could be optimized to be
> shared where possible, overridden where desired -- but at some cost
> in implementation complexity).
>
> I'm not convinced it's worth changing this for ES4. Anyway it is very
> late to have a new proposal -- we are finalizing proposals next week
> at the face-to-face meeting.
FWIW, to emulate classes in our runtime, our constructors always
create a constructor property in the instances they create (pointing
to the constructor) so the class of an instance is given by its
constructor property, and the superclass of a class is its
prototype.constructor property. For that reason, I would be in favor
of this proposal (to make constructor a non-enumerable property of
instance).
More information about the Es4-discuss
mailing list