<?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: Issues with Crockford&#8217;s JavaScript conventions</title>
	<atom:link href="http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/</link>
	<description>The best laid plans are in my other pants</description>
	<lastBuildDate>Thu, 01 Dec 2011 15:21:02 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: TJ Singleton</title>
		<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/comment-page-1/#comment-23960</link>
		<dc:creator>TJ Singleton</dc:creator>
		<pubDate>Wed, 08 Sep 2010 01:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrishowie.com/?p=215#comment-23960</guid>
		<description>I realize this is an old post, but the title caught my eye. When you use a function declaration, it is &#039;hoisted&#039; to the top of the current scope by the interpreter for you. Crockford&#039;s convention is to predefine function expressions. 

Here is a good article I just found that demonstrates this behavior: http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting. I actually found it out watching Crockford&#039;s video series on javascript, http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-3.</description>
		<content:encoded><![CDATA[<p>I realize this is an old post, but the title caught my eye. When you use a function declaration, it is &#8216;hoisted&#8217; to the top of the current scope by the interpreter for you. Crockford&#8217;s convention is to predefine function expressions. </p>
<p>Here is a good article I just found that demonstrates this behavior: <a href="http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting" rel="nofollow">http://www.adequatelygood.com/2010/2/JavaScript-Scoping-and-Hoisting</a>. I actually found it out watching Crockford&#8217;s video series on javascript, <a href="http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-3" rel="nofollow">http://developer.yahoo.com/yui/theater/video.php?v=crockonjs-3</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: OliverB</title>
		<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/comment-page-1/#comment-8114</link>
		<dc:creator>OliverB</dc:creator>
		<pubDate>Tue, 17 Mar 2009 06:51:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrishowie.com/?p=215#comment-8114</guid>
		<description>Crying out for a Haskell where clause... it&#039;s just syntax but it lets you put local declarations at the end of code rather than before.

function foo = blah doStuffLater  where
	doStuffLater = ....</description>
		<content:encoded><![CDATA[<p>Crying out for a Haskell where clause&#8230; it&#8217;s just syntax but it lets you put local declarations at the end of code rather than before.</p>
<p>function foo = blah doStuffLater  where<br />
	doStuffLater = &#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/comment-page-1/#comment-8113</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Tue, 10 Mar 2009 21:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrishowie.com/?p=215#comment-8113</guid>
		<description>@Barry:

At least in JavaScript all functions are closures anyway.  Since &quot;function foo() { ... }&quot; means the same thing as &quot;var foo = function () { ... };&quot; there will be no overhead if you predeclare a variable.  Still ugly though.

I guess we just have a stylistic difference when it comes to how we read code.</description>
		<content:encoded><![CDATA[<p>@Barry:</p>
<p>At least in JavaScript all functions are closures anyway.  Since &#8220;function foo() { &#8230; }&#8221; means the same thing as &#8220;var foo = function () { &#8230; };&#8221; there will be no overhead if you predeclare a variable.  Still ugly though.</p>
<p>I guess we just have a stylistic difference when it comes to how we read code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RichB</title>
		<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/comment-page-1/#comment-8112</link>
		<dc:creator>RichB</dc:creator>
		<pubDate>Tue, 10 Mar 2009 09:22:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrishowie.com/?p=215#comment-8112</guid>
		<description>Declaring variables is aimed at preventing global namespace polution. If you&#039;re not polluting the global namespace with your functions, then you need not worry.</description>
		<content:encoded><![CDATA[<p>Declaring variables is aimed at preventing global namespace polution. If you&#8217;re not polluting the global namespace with your functions, then you need not worry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Barry Kelly</title>
		<link>http://www.chrishowie.com/2009/03/10/issues-with-crockfords-javascript-conventions/comment-page-1/#comment-8111</link>
		<dc:creator>Barry Kelly</dc:creator>
		<pubDate>Tue, 10 Mar 2009 06:59:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrishowie.com/?p=215#comment-8111</guid>
		<description>With mutual recursion, there&#039;s no choice but to live with an undeclared symbol, unless one is to use explicit closures held in declared variables.

However, for your callback example, I personally prefer the style where the callback is declared before it is used. Perhaps it is a preference that has stayed in my mind since I used to program in Pascal, or its related to my knowledge of how compilers work, but I do like to see symbols defined before they are used as I read forward through the code.</description>
		<content:encoded><![CDATA[<p>With mutual recursion, there&#8217;s no choice but to live with an undeclared symbol, unless one is to use explicit closures held in declared variables.</p>
<p>However, for your callback example, I personally prefer the style where the callback is declared before it is used. Perhaps it is a preference that has stayed in my mind since I used to program in Pascal, or its related to my knowledge of how compilers work, but I do like to see symbols defined before they are used as I read forward through the code.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

