<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: ECMA-262-3 in detail. Chapter 4. Scope chain.</title>
	<atom:link href="http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/feed/" rel="self" type="application/rss+xml" />
	<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/</link>
	<description>by Dmitry Soshnikov</description>
	<lastBuildDate>Sun, 13 May 2012 08:41:14 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: ju350213</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-9203</link>
		<dc:creator>ju350213</dc:creator>
		<pubDate>Sun, 20 Nov 2011 01:44:38 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-9203</guid>
		<description>Thanks.I know what you said,but what i want to know is where the implicit [[Prototype]] property of objects is stored.in my opinion,all program execution information are stored in execution context stack,so i can&#039;t associate the two things(scope chain and prototype chain).is memory block which is  used to  store execution context stack information separated from memory block used to store object&#039;s propertys?? In short, i want to know the relationship between the two things(scope chain and prototype chain) in detail.Can you explain it deeply?    thanks!</description>
		<content:encoded><![CDATA[<p>Thanks.I know what you said,but what i want to know is where the implicit [[Prototype]] property of objects is stored.in my opinion,all program execution information are stored in execution context stack,so i can&#8217;t associate the two things(scope chain and prototype chain).is memory block which is  used to  store execution context stack information separated from memory block used to store object&#8217;s propertys?? In short, i want to know the relationship between the two things(scope chain and prototype chain) in detail.Can you explain it deeply?    thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-9185</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Sat, 19 Nov 2011 11:46:19 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-9185</guid>
		<description>@&lt;b&gt;ju350213&lt;/b&gt;

Thanks, I&#039;ve rewritten a bit this sentence; hope now it sounds easier.

&lt;blockquote&gt;I have another question:do the prototype property store in vo??
I mean the implicit __proto__ property you mentioned in the article javascript: the core&lt;/blockquote&gt;

It&#039;s better to put questions related to other articles in their comments. But, on the question -- no, implicit &lt;code&gt;[[Prototype]]&lt;/code&gt; property (which is &lt;code&gt;__proto__&lt;/code&gt; on figures) is the property of objects.

However, in some implementations, e.g. SpiderMonkey (Firefox), the global object (which is VO of the global context) inherits from &lt;code&gt;Object.prototype&lt;/code&gt;. And in this case your sentence makes sense, since the global object is the VO there and has &lt;code&gt;__proto__&lt;/code&gt;.

P.S.: I also fixed typos in lexical environment article, thanks.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>ju350213</b></p>
<p>Thanks, I&#8217;ve rewritten a bit this sentence; hope now it sounds easier.</p>
<blockquote><p>I have another question:do the prototype property store in vo??<br />
I mean the implicit __proto__ property you mentioned in the article javascript: the core</p></blockquote>
<p>It&#8217;s better to put questions related to other articles in their comments. But, on the question &#8212; no, implicit <code>[[Prototype]]</code> property (which is <code>__proto__</code> on figures) is the property of objects.</p>
<p>However, in some implementations, e.g. SpiderMonkey (Firefox), the global object (which is VO of the global context) inherits from <code>Object.prototype</code>. And in this case your sentence makes sense, since the global object is the VO there and has <code>__proto__</code>.</p>
<p>P.S.: I also fixed typos in lexical environment article, thanks.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ju350213</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-9164</link>
		<dc:creator>ju350213</dc:creator>
		<pubDate>Fri, 18 Nov 2011 17:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-9164</guid>
		<description>I mean the  implicit __proto__ property you mentioned in the article  javascript: the core</description>
		<content:encoded><![CDATA[<p>I mean the  implicit __proto__ property you mentioned in the article  javascript: the core</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ju350213</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-9162</link>
		<dc:creator>ju350213</dc:creator>
		<pubDate>Fri, 18 Nov 2011 17:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-9162</guid>
		<description>the sentence &quot;a catch clause that the parameter-exception becomes accessible to it creates new object with the only one property — exception parameter name &quot; is difficult for me to understand. is [that the parameter-exception becomes accessible to it]  a attributive clause
to qualify   [a catch clause]????  forgive  my poor english.
I have another question:do the prototype property store in vo??</description>
		<content:encoded><![CDATA[<p>the sentence &#8220;a catch clause that the parameter-exception becomes accessible to it creates new object with the only one property — exception parameter name &#8221; is difficult for me to understand. is [that the parameter-exception becomes accessible to it]  a attributive clause<br />
to qualify   [a catch clause]????  forgive  my poor english.<br />
I have another question:do the prototype property store in vo??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-427</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Mon, 10 May 2010 13:53:57 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-427</guid>
		<description>@&lt;b&gt;justin&lt;/b&gt;

&lt;blockquote&gt;maybe your mean is &quot;&lt;b&gt;traversing&lt;/b&gt; the scope chain ...&quot;&lt;/blockquote&gt;

Yep, it makes sense; I changed.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>justin</b></p>
<blockquote><p>maybe your mean is &#8220;<b>traversing</b> the scope chain &#8230;&#8221;</p></blockquote>
<p>Yep, it makes sense; I changed.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-426</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Mon, 10 May 2010 13:14:01 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-426</guid>
		<description>@Dmitry
Thank you very much !
more clearly now, I had also get confused by “as one of its objects”.

other:
&lt;blockquote&gt;&lt;b&gt;bypassing&lt;/b&gt; the scope chain in identifier resolution&lt;/blockquote&gt;
maybe your mean is &quot;&lt;b&gt;traversing&lt;/b&gt; the scope chain ...&quot;</description>
		<content:encoded><![CDATA[<p>@Dmitry<br />
Thank you very much !<br />
more clearly now, I had also get confused by “as one of its objects”.</p>
<p>other:</p>
<blockquote><p><b>bypassing</b> the scope chain in identifier resolution</p></blockquote>
<p>maybe your mean is &#8220;<b>traversing</b> the scope chain &#8230;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-425</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Mon, 10 May 2010 12:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-425</guid>
		<description>@&lt;strong&gt;justin&lt;/strong&gt;

&lt;blockquote&gt;may be you means is &quot;exists until the function &lt;b&gt;exits&lt;/b&gt;&quot;&lt;/blockquote&gt;

Yep, it was a typo. Now it is: &lt;em&gt;&quot;exists until the function object is destroyed&quot;&lt;/em&gt;. Which means, that a function&#039;s [[Scope]] (list of parent VOs) will be removed when the function itself will be removed.

&lt;blockquote&gt;&lt;blockquote&gt;[[Scope]] contains as one of its objects that lexical environment (parent variable object) in which function is created. &lt;/blockquote&gt;

It was too bad to understand, could you explain to me?&lt;/blockquote&gt;

I removed the part with &lt;em&gt;&quot;as one of its objects&quot;&lt;/em&gt;. Now it should be clearer. If you carefully read about [[Scope]], you should know that this internal function&#039;s property stores a VO of the context in which a function is created.

Having this code:

[js]var foo;
function bar() {}[/js]

the [[Scope]] of the &quot;bar&quot; function is:

[js]bar.[[Scope]] = { // [[Scope]] is a global object
  foo: undefined,
  bar: &lt;reference to function&gt;,
  __parent__: null
};[/js]

E.g. for inner function &quot;baz&quot; the [[Scope]] is the following:

[js]
var x = 10;
function foo() {
  var bar;
  function baz() {}
}
[/js]

And we have:

[js]baz.[[Scope]] = {
  bar: undefined
  __parent__: foo.[[Scope]] // global
};[/js]

Alternative and more convenient representation of the [[Scope]] isn&#039;t as separate objects with &lt;em&gt;__parent__&lt;/em&gt;, but as an &lt;em&gt;array&lt;/em&gt;. And we use this approach during this chapter. So the [[Scope]] -- is a &lt;em&gt;list&lt;/em&gt; which contains all &lt;em&gt;parent&lt;/em&gt; variable objects (see &lt;a href=&quot;http://bclary.com/2004/11/07/#a-10.1.4&quot; rel=&quot;nofollow&quot;&gt;10.1.4&lt;/a&gt;).

For our &quot;baz&quot; function its internal [[Scope]] array is:

[js]baz.[[Scope]] = [

  // foo&#039;s VO i.e. AO of foo&#039;s context
  {
    bar: undefined,
    baz: &lt;reference to function&gt;
  },

  // global VO
  {
    x: 10
  }

];[/js]

So you see that &quot;baz.[[Scope]]&quot; &lt;em&gt;&quot;contains that (parent) variable object in which function &quot;baz&quot; is created&lt;/em&gt;, i.e. the AO of foo&#039;s context.

And then, when the &quot;baz&quot; will be activated, the scope chain of the baz&#039;s context (a real scope chain which is used for identifier resolution lookup) is:

[js]Scope(baz) = AO(baz) + baz.[[Scope]];[/js]

I.e. &lt;em&gt;Scope(baz)&lt;/em&gt; is being created &lt;em&gt;every time at baz&#039;s activation&lt;/em&gt; and is related with the &lt;em&gt;execution context&lt;/em&gt;. And the &lt;em&gt;baz.[[Scope]]&lt;/em&gt; is created &lt;em&gt;only once&lt;/em&gt; -- at baz&#039;s &lt;em&gt;creation&lt;/em&gt; and related with the &lt;em&gt;baz function&lt;/em&gt;.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<strong>justin</strong></p>
<blockquote><p>may be you means is &#8220;exists until the function <b>exits</b>&#8220;</p></blockquote>
<p>Yep, it was a typo. Now it is: <em>&#8220;exists until the function object is destroyed&#8221;</em>. Which means, that a function&#8217;s [[Scope]] (list of parent VOs) will be removed when the function itself will be removed.</p>
<blockquote><blockquote>[[Scope]] contains as one of its objects that lexical environment (parent variable object) in which function is created. </p></blockquote>
<p>It was too bad to understand, could you explain to me?</p></blockquote>
<p>I removed the part with <em>&#8220;as one of its objects&#8221;</em>. Now it should be clearer. If you carefully read about [[Scope]], you should know that this internal function&#8217;s property stores a VO of the context in which a function is created.</p>
<p>Having this code:</p>
<pre class="brush: jscript; title: ;">var foo;
function bar() {}</pre>
<p>the [[Scope]] of the &#8220;bar&#8221; function is:</p>
<pre class="brush: jscript; title: ;">bar.[[Scope]] = { // [[Scope]] is a global object
  foo: undefined,
  bar: &lt;reference to function&gt;,
  __parent__: null
};</pre>
<p>E.g. for inner function &#8220;baz&#8221; the [[Scope]] is the following:</p>
<pre class="brush: jscript; title: ;">
var x = 10;
function foo() {
  var bar;
  function baz() {}
}
</pre>
<p>And we have:</p>
<pre class="brush: jscript; title: ;">baz.[[Scope]] = {
  bar: undefined
  __parent__: foo.[[Scope]] // global
};</pre>
<p>Alternative and more convenient representation of the [[Scope]] isn&#8217;t as separate objects with <em>__parent__</em>, but as an <em>array</em>. And we use this approach during this chapter. So the [[Scope]] &#8212; is a <em>list</em> which contains all <em>parent</em> variable objects (see <a href="http://bclary.com/2004/11/07/#a-10.1.4" rel="nofollow">10.1.4</a>).</p>
<p>For our &#8220;baz&#8221; function its internal [[Scope]] array is:</p>
<pre class="brush: jscript; title: ;">baz.[[Scope]] = [

  // foo's VO i.e. AO of foo's context
  {
    bar: undefined,
    baz: &lt;reference to function&gt;
  },

  // global VO
  {
    x: 10
  }

];</pre>
<p>So you see that &#8220;baz.[[Scope]]&#8221; <em>&#8220;contains that (parent) variable object in which function &#8220;baz&#8221; is created</em>, i.e. the AO of foo&#8217;s context.</p>
<p>And then, when the &#8220;baz&#8221; will be activated, the scope chain of the baz&#8217;s context (a real scope chain which is used for identifier resolution lookup) is:</p>
<pre class="brush: jscript; title: ;">Scope(baz) = AO(baz) + baz.[[Scope]];</pre>
<p>I.e. <em>Scope(baz)</em> is being created <em>every time at baz&#8217;s activation</em> and is related with the <em>execution context</em>. And the <em>baz.[[Scope]]</em> is created <em>only once</em> &#8212; at baz&#8217;s <em>creation</em> and related with the <em>baz function</em>.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-424</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Mon, 10 May 2010 12:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-424</guid>
		<description>&lt;blockquote&gt;exists until the function &lt;b&gt;exists&lt;/b&gt;&lt;/blockquote&gt;
may be you means is &quot;exists until the function &lt;b&gt;exits&lt;/b&gt;&quot;

&lt;blockquote&gt;[[Scope]] contains as one of its objects that lexical environment (parent variable object) in which function is created. &lt;/blockquote&gt;

It was too bad to understand, could you explain to me?</description>
		<content:encoded><![CDATA[<blockquote><p>exists until the function <b>exists</b></p></blockquote>
<p>may be you means is &#8220;exists until the function <b>exits</b>&#8221;</p>
<blockquote><p>[[Scope]] contains as one of its objects that lexical environment (parent variable object) in which function is created. </p></blockquote>
<p>It was too bad to understand, could you explain to me?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-416</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Sat, 08 May 2010 09:05:15 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-416</guid>
		<description>@&lt;b&gt;justin&lt;/b&gt;

&lt;blockquote&gt;I don’t know how to understand the “bypassing the scope chain.”.&lt;/blockquote&gt;

Yes, a confusing word; I simply removed it.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>justin</b></p>
<blockquote><p>I don’t know how to understand the “bypassing the scope chain.”.</p></blockquote>
<p>Yes, a confusing word; I simply removed it.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: justin</title>
		<link>http://dmitrysoshnikov.com/ecmascript/chapter-4-scope-chain/comment-page-1/#comment-415</link>
		<dc:creator>justin</dc:creator>
		<pubDate>Sat, 08 May 2010 08:49:32 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=623#comment-415</guid>
		<description>thanks!

another question:
&lt;blockquote&gt;starting from the deepest context and up to the top &lt;b&gt;bypassing&lt;/b&gt; the scope chain.&lt;/blockquote&gt;

I don’t know how to understand the “&lt;b&gt;bypassing &lt;/b&gt;the scope chain.”.

I think you means is :&quot;starting from the deepest context and up to the top &lt;b&gt;the scope chain.&lt;/b&gt;&quot;,no &quot;bypass&quot;.

right?</description>
		<content:encoded><![CDATA[<p>thanks!</p>
<p>another question:</p>
<blockquote><p>starting from the deepest context and up to the top <b>bypassing</b> the scope chain.</p></blockquote>
<p>I don’t know how to understand the “<b>bypassing </b>the scope chain.”.</p>
<p>I think you means is :&#8221;starting from the deepest context and up to the top <b>the scope chain.</b>&#8220;,no &#8220;bypass&#8221;.</p>
<p>right?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

