<?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-5 in detail. Chapter 2. Strict Mode.</title>
	<atom:link href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/feed/" rel="self" type="application/rss+xml" />
	<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/</link>
	<description>by Dmitry Soshnikov</description>
	<lastBuildDate>Sat, 04 Feb 2012 03:57:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-6427</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Tue, 29 Mar 2011 20:30:44 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-6427</guid>
		<description>@&lt;b&gt;gossi&lt;/b&gt;

&lt;blockquote&gt;Does the script element encapsulate the strict mode in any way or is it passed through?&lt;/blockquote&gt;

Yes, the strict mode is own per each script element (i.e for each loaded file or evaluated source inside it.

Actually, script element is a separate program, though all these programs share the same global object.

[html]&lt;script&gt;
  &quot;use strict&quot;;
  var a = 10; // OK, no error
&lt;/script&gt;

&lt;script&gt;
  b = 20; // OK, no error
&lt;/script&gt;

&lt;script&gt;
  &quot;use strict&quot;;
  b = 20; // Error
&lt;/script&gt;[/html]

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>gossi</b></p>
<blockquote><p>Does the script element encapsulate the strict mode in any way or is it passed through?</p></blockquote>
<p>Yes, the strict mode is own per each script element (i.e for each loaded file or evaluated source inside it.</p>
<p>Actually, script element is a separate program, though all these programs share the same global object.</p>
<pre class="brush: xml; title: ;">&lt;script&gt;
  &quot;use strict&quot;;
  var a = 10; // OK, no error
&lt;/script&gt;

&lt;script&gt;
  b = 20; // OK, no error
&lt;/script&gt;

&lt;script&gt;
  &quot;use strict&quot;;
  b = 20; // Error
&lt;/script&gt;</pre>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gossi</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-6425</link>
		<dc:creator>gossi</dc:creator>
		<pubDate>Tue, 29 Mar 2011 14:30:55 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-6425</guid>
		<description>Hey Dimitry,

fantastic article. Though I have a question, how the strict mode is handled throughout different files:

[html]&lt;script src=&quot;a.js&quot;&gt;
&lt;script src=&quot;b.js&quot;&gt;
&lt;script&gt;
var mode = 42; // which mode is this here?
&lt;/script&gt;[/html]

a.js:
[js]var foo = &quot;bar&quot;;[/js]

b.js:
[js]&quot;use strict&quot;;
var bar = &quot;baz&quot;;[/js]

In which mode is the rest of the script on this demo? Does the script element encapsulate the strict mode in any way or is it passed through?

Thanks
gossi</description>
		<content:encoded><![CDATA[<p>Hey Dimitry,</p>
<p>fantastic article. Though I have a question, how the strict mode is handled throughout different files:</p>
<pre class="brush: xml; title: ;">&lt;script src=&quot;a.js&quot;&gt;
&lt;script src=&quot;b.js&quot;&gt;
&lt;script&gt;
var mode = 42; // which mode is this here?
&lt;/script&gt;</pre>
<p>a.js:</p>
<pre class="brush: jscript; title: ;">var foo = &quot;bar&quot;;</pre>
<p>b.js:</p>
<pre class="brush: jscript; title: ;">&quot;use strict&quot;;
var bar = &quot;baz&quot;;</pre>
<p>In which mode is the rest of the script on this demo? Does the script element encapsulate the strict mode in any way or is it passed through?</p>
<p>Thanks<br />
gossi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-5833</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Thu, 17 Feb 2011 20:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-5833</guid>
		<description>@&lt;b&gt;Allen Wirfs-Brock&lt;/b&gt;

Yeah, thanks, Allen. I wanted to add this case with indirect &lt;code&gt;eval&lt;/code&gt; regarding creation of global bindings, but hadn&#039;t time before.

Now added, and into three sections (small related mentions in every): &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#strictness-scope&quot; rel=&quot;nofollow&quot;&gt;Strictness scope&lt;/a&gt;, &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codeevalcode-and-codeargumentscode-restrictions&quot; rel=&quot;nofollow&quot;&gt;eval and arguments restrictions&lt;/a&gt; and &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#indirect-eval-call&quot; rel=&quot;nofollow&quot;&gt;Indirect eval call&lt;/a&gt; itself. So, thanks again, it&#039;s a needed addition.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>Allen Wirfs-Brock</b></p>
<p>Yeah, thanks, Allen. I wanted to add this case with indirect <code>eval</code> regarding creation of global bindings, but hadn&#8217;t time before.</p>
<p>Now added, and into three sections (small related mentions in every): <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#strictness-scope" rel="nofollow">Strictness scope</a>, <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codeevalcode-and-codeargumentscode-restrictions" rel="nofollow">eval and arguments restrictions</a> and <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#indirect-eval-call" rel="nofollow">Indirect eval call</a> itself. So, thanks again, it&#8217;s a needed addition.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allen Wirfs-Brock</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-5831</link>
		<dc:creator>Allen Wirfs-Brock</dc:creator>
		<pubDate>Thu, 17 Feb 2011 19:08:28 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-5831</guid>
		<description>In the Strictness Scope section you should probably also discuss that a direct eval in strict code treats the eval code as strict code and that all other evals treat the eval code as non-strict code unless the eval code contains an use strict directive.</description>
		<content:encoded><![CDATA[<p>In the Strictness Scope section you should probably also discuss that a direct eval in strict code treats the eval code as strict code and that all other evals treat the eval code as non-strict code unless the eval code contains an use strict directive.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-1085</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Fri, 09 Jul 2010 09:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-1085</guid>
		<description>@&lt;b&gt;kangax&lt;/b&gt;

Yeah, good points, thanks.

Regarding both -- these were bugs in BESEN. The second one (with &quot;use strict&quot; position) was fixed earlier, but after the article was written. However, the spec is clear in this case -- it is an &lt;em&gt;initial&lt;/em&gt; SourceElement.

The first one is not so easy to catch in spec, but, yeah, obviously, it was also a bug in BESEN, and the spec is also clear here. I&#039;ve talked to BeRo just some minutes ago, it&#039;s fixed now.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>kangax</b></p>
<p>Yeah, good points, thanks.</p>
<p>Regarding both &#8212; these were bugs in BESEN. The second one (with &#8220;use strict&#8221; position) was fixed earlier, but after the article was written. However, the spec is clear in this case &#8212; it is an <em>initial</em> SourceElement.</p>
<p>The first one is not so easy to catch in spec, but, yeah, obviously, it was also a bug in BESEN, and the spec is also clear here. I&#8217;ve talked to BeRo just some minutes ago, it&#8217;s fixed now.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kangax</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-1062</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Thu, 08 Jul 2010 13:46:20 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-1062</guid>
		<description>Awesome overview! :) 

But a couple of important corrections:

1. &quot;eval&quot; and &quot;arguments&quot; not being able to occur as properties — e.g. `({ eval: 1 })` — is a misconception. From what I can see, there&#039;s nothing in the specs that disallows it. The confusion probably comes from the fact that &quot;eval&quot; and &quot;arguments&quot; can NOT occur as /Identifier/ in /PropertySetParameterList/ — `({ set foo(eval, arguments) { } }) /* SyntaxError */` By the way, IIRC, last time I checked, BESEN was incorrectly throwing an error on `({ eval: 1 })`.

2. Use Strict Directive (being an /ExpressionStatement/ in Directive Prologue) can NOT occur anywhere in the scope of a function (or program body), contrary to what you say. Well, technically it can, but then it&#039;s just an /ExpressionStatement/ consisting of a string literal, not a Use Strict Directive. The special nature of /ExpressionStatement/&#039;s in Directive Prologue is that they occur as the _initial /SourceElement/&#039;s_ in function or program. So `alert(1); &quot;use strict&quot;` is not a strict-mode code, but `&quot;use strict&quot;; alert(1);` is.</description>
		<content:encoded><![CDATA[<p>Awesome overview! <img src='http://dmitrysoshnikov.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>But a couple of important corrections:</p>
<p>1. &#8220;eval&#8221; and &#8220;arguments&#8221; not being able to occur as properties — e.g. `({ eval: 1 })` — is a misconception. From what I can see, there&#8217;s nothing in the specs that disallows it. The confusion probably comes from the fact that &#8220;eval&#8221; and &#8220;arguments&#8221; can NOT occur as /Identifier/ in /PropertySetParameterList/ — `({ set foo(eval, arguments) { } }) /* SyntaxError */` By the way, IIRC, last time I checked, BESEN was incorrectly throwing an error on `({ eval: 1 })`.</p>
<p>2. Use Strict Directive (being an /ExpressionStatement/ in Directive Prologue) can NOT occur anywhere in the scope of a function (or program body), contrary to what you say. Well, technically it can, but then it&#8217;s just an /ExpressionStatement/ consisting of a string literal, not a Use Strict Directive. The special nature of /ExpressionStatement/&#8217;s in Directive Prologue is that they occur as the _initial /SourceElement/&#8217;s_ in function or program. So `alert(1); &#8220;use strict&#8221;` is not a strict-mode code, but `&#8221;use strict&#8221;; alert(1);` is.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-621</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Thu, 03 Jun 2010 16:41:02 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-621</guid>
		<description>@&lt;b&gt;Mark S. Miller&lt;/b&gt;

&lt;blockquote&gt;You can track the status of ES5 implementations in progress&lt;/blockquote&gt;

Yeah, thanks Mark, that&#039;s useful.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>Mark S. Miller</b></p>
<blockquote><p>You can track the status of ES5 implementations in progress</p></blockquote>
<p>Yeah, thanks Mark, that&#8217;s useful.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark S. Miller</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-602</link>
		<dc:creator>Mark S. Miller</dc:creator>
		<pubDate>Wed, 02 Jun 2010 14:14:36 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-602</guid>
		<description>You can track the status of ES5 implementations in progress 

&lt;a href=&quot;http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1#track_status_of_es5_implementations_in_progress&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>You can track the status of ES5 implementations in progress </p>
<p><a href="http://wiki.ecmascript.org/doku.php?id=es3.1:es3.1#track_status_of_es5_implementations_in_progress" rel="nofollow">here</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-601</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Wed, 02 Jun 2010 10:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-601</guid>
		<description>@&lt;b&gt;Art&lt;/b&gt;

&lt;blockquote&gt;I&#039;d be useful to know which browsers support this strict mode&lt;/blockquote&gt;

Currently, the only &lt;em&gt;complete&lt;/em&gt; implementation of ES5 is the &lt;em&gt;BESEN&lt;/em&gt; engine. I&#039;ve updated the article, &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#strict-mode-restrictions&quot; rel=&quot;nofollow&quot;&gt;mentioning&lt;/a&gt; it. It still has some bugs, several of them I&#039;ve posted during writing the article -- and glad to see that the implementer has already fixed them. You can download it and test ES5 there now. Hope, some major implementations will follow soon.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>Art</b></p>
<blockquote><p>I&#8217;d be useful to know which browsers support this strict mode</p></blockquote>
<p>Currently, the only <em>complete</em> implementation of ES5 is the <em>BESEN</em> engine. I&#8217;ve updated the article, <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#strict-mode-restrictions" rel="nofollow">mentioning</a> it. It still has some bugs, several of them I&#8217;ve posted during writing the article &#8212; and glad to see that the implementer has already fixed them. You can download it and test ES5 there now. Hope, some major implementations will follow soon.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-600</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Wed, 02 Jun 2010 10:20:40 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-600</guid>
		<description>@&lt;b&gt;Sergey&lt;/b&gt;

&lt;blockquote&gt;Надеюсь появится перевод на русский&lt;/blockquote&gt;

Пока, к сожалению, не планирую; возможно, позже -- когда допишу все части этой новой серии. Но, этим может заняться кто-нибудь другой. Я смогу проверить качество перевода в техническом плане (относительно самого JS имеется в виду); отсюда смогу дать ссылки, как это сделано с китайскими переводами, например.

&lt;blockquote&gt;потому как не совсем все понятно к сожалению. К примеру это:

[js]var get = eval;
get(&quot;alert(x)&quot;); // 10 - from the global context[/js]&lt;/blockquote&gt;

Суть в том, что есть &lt;em&gt;явный (direct)&lt;/em&gt; и &lt;em&gt;неявный (indirect)&lt;/em&gt; вызовы eval&#039;a. Вариации неявного вызова описаны в статье; одна из них -- это использовать другое имя идентификатора. Главный момент, это то, что неявный вызов исполняется всегда в &lt;em&gt;глобальном контексте&lt;/em&gt;, поэтому &quot;x&quot; из примера выше берётся именно оттуда, а не из локального контекста функции.

&lt;blockquote&gt;да и вобще это было единственным местом, где про js можно было почитать на русском и подробно.&lt;/blockquote&gt;

Ну, все русские (оригинальные) статьи серии ES3 по-прежнему здесь. Возможно, появятся из переводы ES5 серии.

Dmitry.</description>
		<content:encoded><![CDATA[<p>@<b>Sergey</b></p>
<blockquote><p>Надеюсь появится перевод на русский</p></blockquote>
<p>Пока, к сожалению, не планирую; возможно, позже &#8212; когда допишу все части этой новой серии. Но, этим может заняться кто-нибудь другой. Я смогу проверить качество перевода в техническом плане (относительно самого JS имеется в виду); отсюда смогу дать ссылки, как это сделано с китайскими переводами, например.</p>
<blockquote><p>потому как не совсем все понятно к сожалению. К примеру это:</p>
<pre class="brush: jscript; title: ;">var get = eval;
get(&quot;alert(x)&quot;); // 10 - from the global context</pre>
</blockquote>
<p>Суть в том, что есть <em>явный (direct)</em> и <em>неявный (indirect)</em> вызовы eval&#8217;a. Вариации неявного вызова описаны в статье; одна из них &#8212; это использовать другое имя идентификатора. Главный момент, это то, что неявный вызов исполняется всегда в <em>глобальном контексте</em>, поэтому &#8220;x&#8221; из примера выше берётся именно оттуда, а не из локального контекста функции.</p>
<blockquote><p>да и вобще это было единственным местом, где про js можно было почитать на русском и подробно.</p></blockquote>
<p>Ну, все русские (оригинальные) статьи серии ES3 по-прежнему здесь. Возможно, появятся из переводы ES5 серии.</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

