From: Garrett Smith on
Richard Cornford wrote:
> On Feb 27, 7:59 am, Garrett Smith wrote:

[...]

>> I also propose the removal that the final paragraph of that section
>> (below). The article already discusses [[Prototype]], but uses the
>> term "prototype" to describe it. I prefer to use the spec's
>> [[Prototype]] notation to avoid confusion between a Function's
>> prototype property and Objects' internal [[Prototype]] property.
>
> Objects in ECMAScript have prototypes, and calling them an object's
> prototype is completely appropriate. "[[Prototype]]" is the name of
> the internal property of the object that refers to its prototype (or
> the first object on its prototype chain). It might be acceptable for
> people familiar with ECMAScript and its prototypes to use
> "[[Prototype]]" as a shorthand for an object's prototype chain but
> that usage is inappropriate in the closures document.
>

When refering to MyObject1's prototype, it is important to be
disambiguate the "MyObject1.prototype" MyObject1's prototype (i.e.
"Function.prototype").

> Use:-
>
> | The instance of MyObject2 referred to by the objectRef variable has
> | a prototype chain. The first object in that chain is the instance
> | of MyObject1 that was created and assigned to the prototype
> | property of the MyObject2 constructor. The instance of MyObject1
> | has a prototype, the object originally assigned to the MyObject1
> | function's prototype property by default (and which has no
> | properties of its own). That object has a prototype, the default
> | Object prototype that corresponds with the object referred to by
> | Object.prototype. Object.prototype has a null prototype so the
> | prototype chain comes to an end at this point.
>
> The proposed diagram is inappropriate.
>

That is your opinion. My opinion is that a diagram (and not necessarily
that one) would help break up the article and make it less verbose.

The parenthetical regarding MyObject1 function's prototype property:-
"(and which has no properties of its own)" - is wrong. Function
MyObject1 was given a prototype property by the implementation (this
happens with all user-defined functions). The value of that property is
an object that has a `constructor` property that points to MyObject1.

Why not remove that parenthetical and instead mention that
MyObject1.prototype was /automatically/ created by the implementation?
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Dr J R Stockton on
In comp.lang.javascript message <hml29c$6pq$1(a)news.eternal-
september.org>, Tue, 2 Mar 2010 23:14:45, Garrett Smith
<dhtmlkitchen(a)gmail.com> posted:
>
>That is your opinion. My opinion is that a diagram (and not necessarily
>that one) would help break up the article and make it less verbose.

With a copy of <URL:http://www.merlyn.demon.co.uk/js-grphx.htm>,
diagrams can be drawn in JavaScript and saved to PNG.

<URL:http://www.merlyn.demon.co.uk/$lag-pts.htm> shows an animated
diagram done in JavaScript.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
From: Garrett Smith on
Garrett Smith wrote:
> Richard Cornford wrote:
>> On Feb 27, 7:59 am, Garrett Smith wrote:
[...]

> The parenthetical regarding MyObject1 function's prototype property:-
> "(and which has no properties of its own)" - is wrong. Function
> MyObject1 was given a prototype property by the implementation (this
> happens with all user-defined functions). The value of that property is
> an object that has a `constructor` property that points to MyObject1.
>
> Why not remove that parenthetical and instead mention that
> MyObject1.prototype was /automatically/ created by the implementation?

e.g.
| The instance of MyObject2 referred to by the objectRef variable has
| a prototype chain. The first object in that chain is the instance
| of MyObject1 that was created and assigned to the prototype
| property of the MyObject2 constructor. The instance of MyObject1
| has a prototype, the object that was assigned to the function
| MyObject1's prototype property by the implementation. That object has
| a prototype, the default Object prototype that corresponds with the
| object referred to by Object.prototype. Object.prototype has a null
| prototype so the prototype chain comes to an end at this point.

?
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Garrett Smith on
Garrett Smith wrote:
> Garrett Smith wrote:
>> Richard Cornford wrote:
>>> On Feb 27, 7:59 am, Garrett Smith wrote:

[...]
> e.g.
> | The instance of MyObject2 referred to by the objectRef variable has
> | a prototype chain. The first object in that chain is the instance
> | of MyObject1 that was created and assigned to the prototype
> | property of the MyObject2 constructor. The instance of MyObject1
> | has a prototype, the object that was assigned to the function
> | MyObject1's prototype property by the implementation. That object has
> | a prototype, the default Object prototype that corresponds with the
> | object referred to by Object.prototype. Object.prototype has a null
> | prototype so the prototype chain comes to an end at this point.
>
> ?

I've uploaded the article with that very text at:

/faq/notes/closures/
--
Garrett
comp.lang.javascript FAQ: http://jibbering.com/faq/