On Mar 1, 2:29 am, Julian Turner <julesb...@gmail.com> wrote:
> Hi Rob
>
> > > 1.   Inheritance in JavaScript is implemented through chains of
> > > prototype objects, ending ultimately at Object.prototype.
>
> > Strictly, it ends with the object referenced by the internal
> > [[prototype]] property of Object.prototype, which is null.
>
> Sorry, yes I should have said that.
>
>
>
> > >  If you
> > > access a property (including a property referencing a function - i.e.
> > > a method) on an object, and the object does not have that property as
> > > its own, then the interpreter will see if the the object's prototype
> > > has that property,
>
> > It uses the object referenced by an object's internal [[prototype]]
> > property, which is (nearly always) a different object to that object's
> > public prototype.
>
> Ahh, ok.  I thought that the internal [[prototype]] was the same
> object as the constructorfunction.prototype.

It is, but you said that property resolution was through the object's
prototype, which it isn't.

To be clear, an object's internal [[prototype]] references the public
prototype of its constructor at the time it was constructed. It is
possible to have an object's public prototype and [[prototype]] be the
same object, but I can't think of a good reason to do that.


--
Rob

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to