<?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: Guarding in JavaScript</title>
	<atom:link href="http://thoughtworker.in/2008/04/25/guarding-in-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/</link>
	<description>Place to serialize my thoughts...</description>
	<lastBuildDate>Thu, 12 Jan 2012 12:54:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Emmett</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-117</link>
		<dc:creator>Emmett</dc:creator>
		<pubDate>Sun, 04 May 2008 17:25:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-117</guid>
		<description>width = specs &amp;&amp; specs.width;
is not exactly the same thing as
if(specs.width) width = specs.width;
The first will always overwrite the value of width; the second will only overwrite width if specs.width exists.</description>
		<content:encoded><![CDATA[<p>width = specs &amp;&amp; specs.width;<br />
is not exactly the same thing as<br />
if(specs.width) width = specs.width;<br />
The first will always overwrite the value of width; the second will only overwrite width if specs.width exists.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: h3</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-118</link>
		<dc:creator>h3</dc:creator>
		<pubDate>Sun, 04 May 2008 07:36:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-118</guid>
		<description>Yeah it&#039;s one of the many things I like in JavaScript (http://www.haineault.com/blog/44/).

It&#039;s also useful to combine it with the &quot;&#124;&#124;&quot; operator, like this:

width = specs &amp;&amp; specs.width &#124;&#124; default.width;</description>
		<content:encoded><![CDATA[<p>Yeah it&#8217;s one of the many things I like in JavaScript (<a href="http://www.haineault.com/blog/44/" rel="nofollow">http://www.haineault.com/blog/44/</a>).</p>
<p>It&#8217;s also useful to combine it with the &#8220;||&#8221; operator, like this:</p>
<p>width = specs &amp;&amp; specs.width || default.width;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kushal</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-116</link>
		<dc:creator>kushal</dc:creator>
		<pubDate>Sun, 04 May 2008 00:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-116</guid>
		<description>C# has an equivalent of &#124;&#124; too. As does SQL: http://kushalm.com/the-null-coalescing-operator-or-how-to-make-default-values-sound-frightening</description>
		<content:encoded><![CDATA[<p>C# has an equivalent of || too. As does SQL: <a href="http://kushalm.com/the-null-coalescing-operator-or-how-to-make-default-values-sound-frightening" rel="nofollow">http://kushalm.com/the-null-coalescing-operator-or-how-to-make-default-values-sound-frightening</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Weekend Reader - twitter, blogging, usability, webdesign, bsg &#171; // Internet Duct Tape</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-115</link>
		<dc:creator>Weekend Reader - twitter, blogging, usability, webdesign, bsg &#171; // Internet Duct Tape</dc:creator>
		<pubDate>Sat, 03 May 2008 15:30:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-115</guid>
		<description>[...] [JAVASCRIPT] Guarding in JavaScript, thoughtworker.in, via:lazycoder.com [...]</description>
		<content:encoded><![CDATA[<p>[...] [JAVASCRIPT] Guarding in JavaScript, thoughtworker.in, via:lazycoder.com [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: engtech</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-112</link>
		<dc:creator>engtech</dc:creator>
		<pubDate>Fri, 25 Apr 2008 16:11:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-112</guid>
		<description>Check out Reg&#039;s andand gem for ruby as well.

It lets you do the equivalent of &amp;&amp; in method chains.

http://andand.rubyforge.org/</description>
		<content:encoded><![CDATA[<p>Check out Reg&#8217;s andand gem for ruby as well.</p>
<p>It lets you do the equivalent of &amp;&amp; in method chains.</p>
<p><a href="http://andand.rubyforge.org/" rel="nofollow">http://andand.rubyforge.org/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prakash</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-113</link>
		<dc:creator>prakash</dc:creator>
		<pubDate>Fri, 25 Apr 2008 13:23:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-113</guid>
		<description>Another important aspect of these operators is the &quot;short-circuiting&quot; behavior. The second operand is evaluated only if the first operand can not determine the value of the expression. In the case of &#039;&#124;&#124;&#039; operator, for example, the second operand isn&#039;t evaluated if the first operand is true.

Most dynamic languages whose ancestry can be traced back to C (which was the first to &quot;spell&quot; these operators like this) support this type of logical operator behaviour.

AFAIK, Perl was the the first language that borrowed this &quot;short-circuit&quot; behavior from C and and improved it. Whereas in C the expression in the RHS evaluates to either 0 or 1, in most dynamic languages, the RHS evaluates to one of the two operands. This improvement, as you have noticed, gives rise to very concise and efficient, yet readable, code.</description>
		<content:encoded><![CDATA[<p>Another important aspect of these operators is the &#8220;short-circuiting&#8221; behavior. The second operand is evaluated only if the first operand can not determine the value of the expression. In the case of &#8216;||&#8217; operator, for example, the second operand isn&#8217;t evaluated if the first operand is true.</p>
<p>Most dynamic languages whose ancestry can be traced back to C (which was the first to &#8220;spell&#8221; these operators like this) support this type of logical operator behaviour.</p>
<p>AFAIK, Perl was the the first language that borrowed this &#8220;short-circuit&#8221; behavior from C and and improved it. Whereas in C the expression in the RHS evaluates to either 0 or 1, in most dynamic languages, the RHS evaluates to one of the two operands. This improvement, as you have noticed, gives rise to very concise and efficient, yet readable, code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sid</title>
		<link>http://thoughtworker.in/2008/04/25/guarding-in-javascript/comment-page-1/#comment-114</link>
		<dc:creator>Sid</dc:creator>
		<pubDate>Fri, 25 Apr 2008 04:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.thoughtworker.in/?p=65#comment-114</guid>
		<description>Ruby does the same thing with both &amp;&amp; and &#124;&#124;</description>
		<content:encoded><![CDATA[<p>Ruby does the same thing with both &amp;&amp; and ||</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  thoughtworker.in/2008/04/25/guarding-in-javascript/feed/ ) in 0.32292 seconds, on Feb 7th, 2012 at 8:53 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 7th, 2012 at 9:53 pm UTC -->
