<?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>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: Dmitry Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-13075</link>
		<dc:creator>Dmitry Soshnikov</dc:creator>
		<pubDate>Sat, 17 Mar 2012 08:16:08 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-13075</guid>
		<description>@&lt;b&gt;Yuriy&lt;/b&gt;

Да, в случае &lt;code&gt;delete&lt;/code&gt;&#039;a исключение &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codedeletecode-operator-restrictions&quot; rel=&quot;nofollow&quot;&gt;будет&lt;/a&gt;, т.к. &lt;code&gt;var&lt;/code&gt; &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/chapter-2-variable-object/#about-variables&quot; rel=&quot;nofollow&quot;&gt;создает&lt;/a&gt; &lt;code&gt;non-[[Configurable]]&lt;/code&gt; &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-1-properties-and-property-descriptors/#property-attributes&quot; rel=&quot;nofollow&quot;&gt;свойство&lt;/a&gt; (только если это не контекст &lt;code&gt;eval&lt;/code&gt;&#039;a).

По поводу ASI (Automatic Semicolon Insertion) -- нет, точка с запятой все еще дополняется автоматом. Хотя, были дебаты, что могли бы убрать этот механизм в строгом режиме. С другой стороны, точки с запятыми тоже можно отнести к &quot;синтаксическому мусору&quot; в языке. Однако все ставят в крупных проектах из-за порой сложных правил ASI.</description>
		<content:encoded><![CDATA[<p>@<b>Yuriy</b></p>
<p>Да, в случае <code>delete</code>&#8216;a исключение <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codedeletecode-operator-restrictions" rel="nofollow">будет</a>, т.к. <code>var</code> <a href="http://dmitrysoshnikov.com/ecmascript/chapter-2-variable-object/#about-variables" rel="nofollow">создает</a> <code>non-[[Configurable]]</code> <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-1-properties-and-property-descriptors/#property-attributes" rel="nofollow">свойство</a> (только если это не контекст <code>eval</code>&#8216;a).</p>
<p>По поводу ASI (Automatic Semicolon Insertion) &#8212; нет, точка с запятой все еще дополняется автоматом. Хотя, были дебаты, что могли бы убрать этот механизм в строгом режиме. С другой стороны, точки с запятыми тоже можно отнести к &#8220;синтаксическому мусору&#8221; в языке. Однако все ставят в крупных проектах из-за порой сложных правил ASI.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuriy</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-13072</link>
		<dc:creator>Yuriy</dc:creator>
		<pubDate>Fri, 16 Mar 2012 19:30:03 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-13072</guid>
		<description>Спасибо за такую подробную статью.

Не совсем понял про delete локальных переменных:
[js]
(function () {
    &quot;use strict&quot;;
    var a = 1;
    delete a; // будет ли исключение?
})();
[/js]

И есть ли в ES5 какие-нибудь изменения про обязательность ; в конце строк?</description>
		<content:encoded><![CDATA[<p>Спасибо за такую подробную статью.</p>
<p>Не совсем понял про delete локальных переменных:</p>
<pre class="brush: jscript; title: ;">
(function () {
    &quot;use strict&quot;;
    var a = 1;
    delete a; // будет ли исключение?
})();
</pre>
<p>И есть ли в ES5 какие-нибудь изменения про обязательность ; в конце строк?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry Soshnikov</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-13066</link>
		<dc:creator>Dmitry Soshnikov</dc:creator>
		<pubDate>Thu, 15 Mar 2012 03:47:55 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-13066</guid>
		<description>@&lt;b&gt;Mathias Bynens&lt;/b&gt;

Seems just an old typo in exactly that sentence (will fix, thanks). Because if you&#039;ll carefully read &lt;a href=&quot;http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codeevalcode-and-codeargumentscode-restrictions&quot; rel=&quot;nofollow&quot;&gt;related section from above&lt;/a&gt;, you see I write that &lt;code&gt;eval&lt;/code&gt; and &lt;code&gt;arguments&lt;/code&gt; are allowed as property names.</description>
		<content:encoded><![CDATA[<p>@<b>Mathias Bynens</b></p>
<p>Seems just an old typo in exactly that sentence (will fix, thanks). Because if you&#8217;ll carefully read <a href="http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/#codeevalcode-and-codeargumentscode-restrictions" rel="nofollow">related section from above</a>, you see I write that <code>eval</code> and <code>arguments</code> are allowed as property names.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias Bynens</title>
		<link>http://dmitrysoshnikov.com/ecmascript/es5-chapter-2-strict-mode/comment-page-1/#comment-13062</link>
		<dc:creator>Mathias Bynens</dc:creator>
		<pubDate>Wed, 14 Mar 2012 16:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://dmitrysoshnikov.com/?p=1341#comment-13062</guid>
		<description>&lt;blockquote&gt;[…] &lt;code&gt;eval&lt;/code&gt; and &lt;code&gt;arguments&lt;/code&gt; identifiers are not allowed for assignment, function argument names or property names […]&lt;/blockquote&gt;

Why wouldn’t they be allowed for &lt;a href=&quot;http://mathiasbynens.be/notes/javascript-properties&quot; rel=&quot;nofollow&quot;&gt;property names&lt;/a&gt;? The spec only mentions &lt;a href=&quot;http://es5.github.com/x12.html#x12.2.1&quot; rel=&quot;nofollow&quot;&gt;the following&lt;/a&gt;:

&lt;blockquote cite=&quot;http://es5.github.com/x12.html#x12.2.1&quot;&gt;It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code and its Identifier is either &lt;code&gt;eval&lt;/code&gt; or &lt;code&gt;arguments&lt;/code&gt;.&lt;/blockquote&gt;

So, I don’t see why this would throw an error:

[js]
(function() {
  &#039;use strict&#039;;
  var object = {
    eval: 1,
    arguments: 2
  };
}());
[/js]

Could you please clarify? Thanks!</description>
		<content:encoded><![CDATA[<blockquote><p>[…] <code>eval</code> and <code>arguments</code> identifiers are not allowed for assignment, function argument names or property names […]</p></blockquote>
<p>Why wouldn’t they be allowed for <a href="http://mathiasbynens.be/notes/javascript-properties" rel="nofollow">property names</a>? The spec only mentions <a href="http://es5.github.com/x12.html#x12.2.1" rel="nofollow">the following</a>:</p>
<blockquote cite="http://es5.github.com/x12.html#x12.2.1"><p>It is a SyntaxError if a VariableDeclaration or VariableDeclarationNoIn occurs within strict code and its Identifier is either <code>eval</code> or <code>arguments</code>.</p></blockquote>
<p>So, I don’t see why this would throw an error:</p>
<pre class="brush: jscript; title: ;">
(function() {
  'use strict';
  var object = {
    eval: 1,
    arguments: 2
  };
}());
</pre>
<p>Could you please clarify? Thanks!</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-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>
</channel>
</rss>

