<?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: arguments considered harmful</title>
	<atom:link href="http://www.jspatterns.com/arguments-considered-harmful/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jspatterns.com/arguments-considered-harmful/</link>
	<description>Exploring common JavaScript patterns and anti-patterns</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:54:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: pipe</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-47214</link>
		<dc:creator>pipe</dc:creator>
		<pubDate>Mon, 30 Jan 2012 16:24:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-47214</guid>
		<description>http://misjazdrowia.pl/ misja zdrowia</description>
		<content:encoded><![CDATA[<p><a href="http://misjazdrowia.pl/" rel="nofollow">http://misjazdrowia.pl/</a> misja zdrowia</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Poncjan</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-32409</link>
		<dc:creator>Poncjan</dc:creator>
		<pubDate>Mon, 03 Oct 2011 15:07:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-32409</guid>
		<description>How much of an exciting short article, continue posting mate</description>
		<content:encoded><![CDATA[<p>How much of an exciting short article, continue posting mate</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias Bynens</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-17402</link>
		<dc:creator>Mathias Bynens</dc:creator>
		<pubDate>Thu, 28 Apr 2011 11:03:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-17402</guid>
		<description>Here’s a jsPerf test case showing the performance implications of using the &lt;code&gt;arguments&lt;/code&gt; object: http://jsperf.com/arguments</description>
		<content:encoded><![CDATA[<p>Here’s a jsPerf test case showing the performance implications of using the <code>arguments</code> object: <a href="http://jsperf.com/arguments" rel="nofollow">http://jsperf.com/arguments</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stoyan</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-2158</link>
		<dc:creator>stoyan</dc:creator>
		<pubDate>Thu, 18 Feb 2010 11:04:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-2158</guid>
		<description>@Dmitry, I just looked around javascript.ru - it&#039;s an incredible resource, good job!</description>
		<content:encoded><![CDATA[<p>@Dmitry, I just looked around javascript.ru &#8211; it&#8217;s an incredible resource, good job!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stoyan</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-2157</link>
		<dc:creator>stoyan</dc:creator>
		<pubDate>Thu, 18 Feb 2010 10:56:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-2157</guid>
		<description>this is valid point you guys raise, it&#039;s not arguments that is to blame, it&#039;s the fact that objects are passed by reference. so the same will happen with any object. However, when A is passing arguments to B, A probably doesn&#039;t expect them to change, just because of the nature of the task - passing arguments.  My example was just showing how easy it is for B to change them even unintentionally. Of course `A` can be defensive and pass a deep copy of arguments so it doesn&#039;t get overwritten by mistake.

Dmitry, I was referring to these tests:
http://webreflection.blogspot.com/2010/02/arguments-callee-call-and-apply.html
Looks like all JS engines avoid creating arguments, unless necessary. V8 is the only engine where performance doesn&#039;t suffer but only if there&#039;s no arguments passed.</description>
		<content:encoded><![CDATA[<p>this is valid point you guys raise, it&#8217;s not arguments that is to blame, it&#8217;s the fact that objects are passed by reference. so the same will happen with any object. However, when A is passing arguments to B, A probably doesn&#8217;t expect them to change, just because of the nature of the task &#8211; passing arguments.  My example was just showing how easy it is for B to change them even unintentionally. Of course `A` can be defensive and pass a deep copy of arguments so it doesn&#8217;t get overwritten by mistake.</p>
<p>Dmitry, I was referring to these tests:<br />
<a href="http://webreflection.blogspot.com/2010/02/arguments-callee-call-and-apply.html" rel="nofollow">http://webreflection.blogspot.com/2010/02/arguments-callee-call-and-apply.html</a><br />
Looks like all JS engines avoid creating arguments, unless necessary. V8 is the only engine where performance doesn&#8217;t suffer but only if there&#8217;s no arguments passed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dmitry A. Soshnikov</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-2149</link>
		<dc:creator>Dmitry A. Soshnikov</dc:creator>
		<pubDate>Wed, 17 Feb 2010 21:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-2149</guid>
		<description>Hi, thanks for the article.

&lt;blockquote&gt;The arguments object is not automatically created every time the function is called, the JavaScript engine will only create it on-demand, if it&#039;s used&lt;/blockquote&gt;

Which exactly &quot;JavaScript engine&quot; is meant? Where did you get this exact info? Although, it can be true in some implementations (yep, it&#039;s the good optimization as all needed info about the context is available on parsing the code, so there&#039;s no need to create &lt;em&gt;arguments&lt;/em&gt; object if it was not found on parsing), but as you know ECMA-262-3 statements, that &lt;em&gt;arguments&lt;/em&gt; object is created each time on entering the execution context.

Consider this example that illustrates the second case (B changing values behind A&#039;s unsuspecting back)

Nothing is wrong, nothing is odd. It&#039;s the same if you simply pass an object (or an array to A and then will pass this argument to B). Moreover, &lt;em&gt;arguments&lt;/em&gt; name can be used (although, it will be an error in &quot;strict mode&quot; of ES5):

function foo(arguments) {
  console.dir(arguments); // {a: 10, b: 20}
  bar(arguments);
  // oops? why &quot;oops&quot;? that&#039;s the common
  // ECMAScript behavior
  console.dir(arguments); // {a: 100, b: 20}
}

function bar(args) {
  args.a = 100;
}

foo({a: 10, b: 20});

Dmitry.</description>
		<content:encoded><![CDATA[<p>Hi, thanks for the article.</p>
<blockquote><p>The arguments object is not automatically created every time the function is called, the JavaScript engine will only create it on-demand, if it&#8217;s used</p></blockquote>
<p>Which exactly &#8220;JavaScript engine&#8221; is meant? Where did you get this exact info? Although, it can be true in some implementations (yep, it&#8217;s the good optimization as all needed info about the context is available on parsing the code, so there&#8217;s no need to create <em>arguments</em> object if it was not found on parsing), but as you know ECMA-262-3 statements, that <em>arguments</em> object is created each time on entering the execution context.</p>
<p>Consider this example that illustrates the second case (B changing values behind A&#8217;s unsuspecting back)</p>
<p>Nothing is wrong, nothing is odd. It&#8217;s the same if you simply pass an object (or an array to A and then will pass this argument to B). Moreover, <em>arguments</em> name can be used (although, it will be an error in &#8220;strict mode&#8221; of ES5):</p>
<p>function foo(arguments) {<br />
  console.dir(arguments); // {a: 10, b: 20}<br />
  bar(arguments);<br />
  // oops? why &#8220;oops&#8221;? that&#8217;s the common<br />
  // ECMAScript behavior<br />
  console.dir(arguments); // {a: 100, b: 20}<br />
}</p>
<p>function bar(args) {<br />
  args.a = 100;<br />
}</p>
<p>foo({a: 10, b: 20});</p>
<p>Dmitry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jordan Boesch</title>
		<link>http://www.jspatterns.com/arguments-considered-harmful/#comment-2141</link>
		<dc:creator>Jordan Boesch</dc:creator>
		<pubDate>Tue, 16 Feb 2010 19:47:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=68#comment-2141</guid>
		<description>Interesting! I always knew it was a bit of a performance hit to bring &#039;arguments&#039; in to the local scope but I had no idea it passed arguments by reference.  I noticed if you change 

&lt;code&gt;B(arguments);&lt;/code&gt;
to 
&lt;code&gt;B([obj, ar]);&lt;/code&gt;

it has the same effect, so I guess this isn&#039;t specifically a problem with the &#039;arguments&#039; object... thoughts?</description>
		<content:encoded><![CDATA[<p>Interesting! I always knew it was a bit of a performance hit to bring &#8216;arguments&#8217; in to the local scope but I had no idea it passed arguments by reference.  I noticed if you change </p>
<p><code>B(arguments);</code><br />
to<br />
<code>B([obj, ar]);</code></p>
<p>it has the same effect, so I guess this isn&#8217;t specifically a problem with the &#8216;arguments&#8217; object&#8230; thoughts?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

