<?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"
	>
<channel>
	<title>Comments for JSPatterns.com</title>
	<atom:link href="http://www.jspatterns.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jspatterns.com</link>
	<description>Exploring common JavaScript patterns and anti-patterns</description>
	<pubDate>Fri, 12 Mar 2010 07:39:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5-RC1</generator>
		<item>
		<title>Comment on Enforcing `new` in constructors by Phoscur</title>
		<link>http://www.jspatterns.com/enforcing-new-in-constructors/#comment-2181</link>
		<dc:creator>Phoscur</dc:creator>
		<pubDate>Mon, 22 Feb 2010 00:38:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=53#comment-2181</guid>
		<description>function Constructor() {
  var that = (this === window) ? {} : this;
  ...
  return that;
}
I hope you aren't serious with this. It just doesn't make sense, as JavaScript always invokes the function as a non-constructor (if you put a new before just doesn't matter) because it returns something. The condition is always true and thereby unneeded.</description>
		<content:encoded><![CDATA[<p>function Constructor() {<br />
  var that = (this === window) ? {} : this;<br />
  &#8230;<br />
  return that;<br />
}<br />
I hope you aren&#8217;t serious with this. It just doesn&#8217;t make sense, as JavaScript always invokes the function as a non-constructor (if you put a new before just doesn&#8217;t matter) because it returns something. The condition is always true and thereby unneeded.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on arguments considered harmful 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's an incredible resource, good job!</description>
		<content:encoded><![CDATA[<p>@Dmitry, I just looked around javascript.ru - it&#8217;s an incredible resource, good job!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on arguments considered harmful 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's not arguments that is to blame, it'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'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'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't suffer but only if there'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 - 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>Comment on arguments considered harmful 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's used&lt;/blockquote&gt;

Which exactly "JavaScript engine" is meant? Where did you get this exact info? Although, it can be true in some implementations (yep, it's the good optimization as all needed info about the context is available on parsing the code, so there'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's unsuspecting back)

Nothing is wrong, nothing is odd. It'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 "strict mode" of ES5):

function foo(arguments) {
  console.dir(arguments); // {a: 10, b: 20}
  bar(arguments);
  // oops? why "oops"? that'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>Comment on arguments considered harmful 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 'arguments' 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't specifically a problem with the 'arguments' 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>
	<item>
		<title>Comment on Lazy definition function by nghia</title>
		<link>http://www.jspatterns.com/lazy-definition-function/#comment-2018</link>
		<dc:creator>nghia</dc:creator>
		<pubDate>Mon, 18 Jan 2010 14:27:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=66#comment-2018</guid>
		<description>Hi Stoyan Stefanov
please answer me a question : What is Lazy definition function used for? and when we use it ?</description>
		<content:encoded><![CDATA[<p>Hi Stoyan Stefanov<br />
please answer me a question : What is Lazy definition function used for? and when we use it ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Returning functions by JSPatterns.com &#187; Blog Archive &#187; Self-overwriting functions</title>
		<link>http://www.jspatterns.com/returning-functions/#comment-1354</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; Self-overwriting functions</dc:creator>
		<pubDate>Tue, 15 Sep 2009 18:18:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=64#comment-1354</guid>
		<description>[...] Exploring common JavaScript patterns and anti-patterns &#160;      &#171; Returning functions [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Exploring common JavaScript patterns and anti-patterns &nbsp;      &laquo; Returning functions [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Classical inheritance by JSPatterns.com &#187; Blog Archive &#187; Prototypal inheritance</title>
		<link>http://www.jspatterns.com/classical-inheritance/#comment-1353</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; Prototypal inheritance</dc:creator>
		<pubDate>Tue, 15 Sep 2009 17:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=59#comment-1353</guid>
		<description>[...] Exploring common JavaScript patterns and anti-patterns &#160;      &#171; Classical inheritance [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Exploring common JavaScript patterns and anti-patterns &nbsp;      &laquo; Classical inheritance [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Borrowing methods pattern by JSPatterns.com &#187; Blog Archive &#187; Classical inheritance</title>
		<link>http://www.jspatterns.com/borrowing-methods-pattern/#comment-1352</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; Classical inheritance</dc:creator>
		<pubDate>Tue, 15 Sep 2009 17:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=56#comment-1352</guid>
		<description>[...] next pattern solves the problem of passing arguments. It borrows the parent constructor passing the child object to be bound to this and passing any [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] next pattern solves the problem of passing arguments. It borrows the parent constructor passing the child object to be bound to this and passing any [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Inheritance by copying properties by JSPatterns.com &#187; Blog Archive &#187; Mixins</title>
		<link>http://www.jspatterns.com/inheritance-by-copying-properties/#comment-1349</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; Mixins</dc:creator>
		<pubDate>Tue, 15 Sep 2009 15:00:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=57#comment-1349</guid>
		<description>[...] Exploring common JavaScript patterns and anti-patterns &#160;      &#171; Inheritance by copying properties [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Exploring common JavaScript patterns and anti-patterns &nbsp;      &laquo; Inheritance by copying properties [&#8230;]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
