13.2.2 [[Construct]], constructor, and [[Class]] (was __proto__)
P T Withington
ptw at pobox.com
Fri Dec 14 12:50:03 PST 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.
So, was nothing done about this? We're starting to work on an es4
back-end for our stuff and running into this issue. We can make sure
all our constructors give each instance a constructor slot (and we can
smash the class prototype.constructor to point to the superclass) as
we do for our es3 back end; but I was really hoping for a cleaner
solution in es4.
Is there some other way in es4 that from an instance one can navigate
up the superclass chain? Can I say:
super.constructor
perhaps, to find my class's superclass?
More information about the Es4-discuss
mailing list