<?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: var scoping &#8211; how and where do you set your function variables?</title>
	<atom:link href="http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/</link>
	<description>Rich Internet Application development</description>
	<lastBuildDate>Tue, 31 Jan 2012 15:10:27 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: ike</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82626</link>
		<dc:creator>ike</dc:creator>
		<pubDate>Mon, 24 Nov 2008 01:52:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82626</guid>
		<description>I don&#039;t think I would describe it as &quot;against the grain&quot;... This is the way JavaScript works with the exception that JavaScript allows you to declare new local variables with var anywhere in the function. And my understanding is that JS is far from the only language in which that&#039;s true. Personally I comparatively consider the fact that &quot;this&quot; means &quot;public&quot; instead of &quot;private&quot; or the fact that output=&quot;true&quot; is the *default* for new functions are much more &quot;against the grain&quot; than the use of var. 

But Adobe will also have to add new language constructs to support a change to the use of var, which I believe will be in the form of another attribute in the function or in the CFC to turn on or off the current default behavior that tells it to create variables in the private variables scope when the scope isn&#039;t explicitly declared. Which means you&#039;ll still have to remember to apply it (just like you do with JavaScript) -- although hopefully it will be a bit easier especially since I believe you&#039;ll be able to declare it at the cfcomponent tag. Even at the cffunction tag it should be much more manageable.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think I would describe it as &#8220;against the grain&#8221;&#8230; This is the way JavaScript works with the exception that JavaScript allows you to declare new local variables with var anywhere in the function. And my understanding is that JS is far from the only language in which that&#8217;s true. Personally I comparatively consider the fact that &#8220;this&#8221; means &#8220;public&#8221; instead of &#8220;private&#8221; or the fact that output=&#8221;true&#8221; is the *default* for new functions are much more &#8220;against the grain&#8221; than the use of var. </p>
<p>But Adobe will also have to add new language constructs to support a change to the use of var, which I believe will be in the form of another attribute in the function or in the CFC to turn on or off the current default behavior that tells it to create variables in the private variables scope when the scope isn&#8217;t explicitly declared. Which means you&#8217;ll still have to remember to apply it (just like you do with JavaScript) &#8212; although hopefully it will be a bit easier especially since I believe you&#8217;ll be able to declare it at the cfcomponent tag. Even at the cffunction tag it should be much more manageable.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82596</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Sun, 23 Nov 2008 22:01:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82596</guid>
		<description>@Allen - agreed +5 hehe. It is certainly crazy, I think I even heard along the grapevine that this will be resolved in Centaur. Let&#039;s hope so.</description>
		<content:encoded><![CDATA[<p>@Allen &#8211; agreed +5 hehe. It is certainly crazy, I think I even heard along the grapevine that this will be resolved in Centaur. Let&#8217;s hope so.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allen Graetz</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82595</link>
		<dc:creator>Allen Graetz</dc:creator>
		<pubDate>Sun, 23 Nov 2008 21:50:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82595</guid>
		<description>Let&#039;s not forget the bigger picture.  The real problem isn&#039;t were we use the var keyword but that we have to use it at all.  Variables in methods should have been private unless otherwise specified from the start.  By again going against the grain, ColdFusion created a bunch of busy work for ColdFusion developers for what now?  The last 5 years?  7?</description>
		<content:encoded><![CDATA[<p>Let&#8217;s not forget the bigger picture.  The real problem isn&#8217;t were we use the var keyword but that we have to use it at all.  Variables in methods should have been private unless otherwise specified from the start.  By again going against the grain, ColdFusion created a bunch of busy work for ColdFusion developers for what now?  The last 5 years?  7?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ike</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82591</link>
		<dc:creator>ike</dc:creator>
		<pubDate>Sun, 23 Nov 2008 21:39:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82591</guid>
		<description>Yeah, I&#039;ve thought the top-of-function restriction was silly ever since CF5 personally.</description>
		<content:encoded><![CDATA[<p>Yeah, I&#8217;ve thought the top-of-function restriction was silly ever since CF5 personally.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82578</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Sun, 23 Nov 2008 20:09:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82578</guid>
		<description>@Rachel
&gt;The whole issue is silly, I sure hope that Centaur removes the “top of the function block” restriction on var scoping.

Agreed! Maybe you have the inside scoop as to whether this really will be resolved :)

&gt;but after running that code through varScoper, I realized it was making me miss way too many variables so I stopped!

I know what you mean, I typically run everything through varScoper every few days just to be safe. But also generally speaking I try to keep my methods small and compact so hopefully much like comments...there isn&#039;t a need to use a specific struct for this.

&gt;The whole issue is silly, I sure hope that Centaur removes the “top of the function block” restriction on var scoping.

Just thought I&#039;d add another +1 for this because it really is ridiculous.</description>
		<content:encoded><![CDATA[<p>@Rachel<br />
>The whole issue is silly, I sure hope that Centaur removes the “top of the function block” restriction on var scoping.</p>
<p>Agreed! Maybe you have the inside scoop as to whether this really will be resolved <img src='http://www.chapter31.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>>but after running that code through varScoper, I realized it was making me miss way too many variables so I stopped!</p>
<p>I know what you mean, I typically run everything through varScoper every few days just to be safe. But also generally speaking I try to keep my methods small and compact so hopefully much like comments&#8230;there isn&#8217;t a need to use a specific struct for this.</p>
<p>>The whole issue is silly, I sure hope that Centaur removes the “top of the function block” restriction on var scoping.</p>
<p>Just thought I&#8217;d add another +1 for this because it really is ridiculous.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel Lehman</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-82561</link>
		<dc:creator>Rachel Lehman</dc:creator>
		<pubDate>Sun, 23 Nov 2008 17:53:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-82561</guid>
		<description>I&#039;ve run into the same issue with name conflicts in the word &quot;local&quot;. Instead of using &quot;local&quot; as the structure name for your local variables, you can use &quot;private&quot; (that&#039;s what we do at my company) or another non reserved word. A personal issue I have with that is that adding &quot;private&quot; or &quot;local&quot; before every single variable quickly makes code unreadable. If it&#039;s a personal project where I&#039;m not following our usual coding standard, I prefer shorter names like &quot;loc&quot; or &quot;pvt&quot; - less typing, less in between my variable names. 
I used to just declare all the local variables up front in every method and not put them in a structure (even thought I was aware of this workaround), but after running that code through varScoper, I realized it was making me miss way too many variables so I stopped!
The whole issue is silly, I sure hope that Centaur removes the &quot;top of the function block&quot; restriction on var scoping.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve run into the same issue with name conflicts in the word &#8220;local&#8221;. Instead of using &#8220;local&#8221; as the structure name for your local variables, you can use &#8220;private&#8221; (that&#8217;s what we do at my company) or another non reserved word. A personal issue I have with that is that adding &#8220;private&#8221; or &#8220;local&#8221; before every single variable quickly makes code unreadable. If it&#8217;s a personal project where I&#8217;m not following our usual coding standard, I prefer shorter names like &#8220;loc&#8221; or &#8220;pvt&#8221; &#8211; less typing, less in between my variable names.<br />
I used to just declare all the local variables up front in every method and not put them in a structure (even thought I was aware of this workaround), but after running that code through varScoper, I realized it was making me miss way too many variables so I stopped!<br />
The whole issue is silly, I sure hope that Centaur removes the &#8220;top of the function block&#8221; restriction on var scoping.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: larry c. lyons</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-81738</link>
		<dc:creator>larry c. lyons</dc:creator>
		<pubDate>Mon, 17 Nov 2008 15:55:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-81738</guid>
		<description>FWIW I generally do the same, declaring empty local variables immediately after the arguments declarations, then explicitly populating them later. That&#039;s one thing that the New Atlanta people got right with Blue Dragon. You can var scope a variable anywhere within the function block.</description>
		<content:encoded><![CDATA[<p>FWIW I generally do the same, declaring empty local variables immediately after the arguments declarations, then explicitly populating them later. That&#8217;s one thing that the New Atlanta people got right with Blue Dragon. You can var scope a variable anywhere within the function block.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-81459</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Sun, 16 Nov 2008 00:45:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-81459</guid>
		<description>@Allen - Yep, that won&#039;t work with QoQ because &lt;a href=&quot;http://www.bennadel.com/blog/94-LOCAL-Variables-Scope-Conflicts-With-ColdFusion-Query-of-Queries.htm&quot; rel=&quot;nofollow&quot;&gt;from Ben Nadel&#039;s blog&lt;/a&gt;:

&quot;LOCAL is a reserved word in SQL and ColdFusion Query of Query SQL. The solution: use the [ ] notation&quot;</description>
		<content:encoded><![CDATA[<p>@Allen &#8211; Yep, that won&#8217;t work with QoQ because <a href="http://www.bennadel.com/blog/94-LOCAL-Variables-Scope-Conflicts-With-ColdFusion-Query-of-Queries.htm" rel="nofollow">from Ben Nadel&#8217;s blog</a>:</p>
<p>&#8220;LOCAL is a reserved word in SQL and ColdFusion Query of Query SQL. The solution: use the [ ] notation&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Allen</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-81388</link>
		<dc:creator>Allen</dc:creator>
		<pubDate>Sat, 15 Nov 2008 14:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-81388</guid>
		<description>I like local scope because I only have to do it once.  One issue is if for some reason you have a query of queries.  I haven&#039;t chased this one down yet but if I have a query named local.beerQuery and then try to later do a q-o-q and have something like select * from local.beerQuery, ColdFusion doesn&#039;t seem to recognize local.beerQueer.  Like I said, I haven&#039;t chased this one down but it&#039;s the one time I&#039;ll do some extra var&#039;s at the top.</description>
		<content:encoded><![CDATA[<p>I like local scope because I only have to do it once.  One issue is if for some reason you have a query of queries.  I haven&#8217;t chased this one down yet but if I have a query named local.beerQuery and then try to later do a q-o-q and have something like select * from local.beerQuery, ColdFusion doesn&#8217;t seem to recognize local.beerQueer.  Like I said, I haven&#8217;t chased this one down but it&#8217;s the one time I&#8217;ll do some extra var&#8217;s at the top.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Sharman</title>
		<link>http://www.chapter31.com/2008/11/12/var-scoping-how-and-where-do-you-set-your-function-variables/comment-page-1/#comment-80980</link>
		<dc:creator>Michael Sharman</dc:creator>
		<pubDate>Wed, 12 Nov 2008 21:47:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.chapter31.com/?p=418#comment-80980</guid>
		<description>@Hem - Sorry about that, I must have a look into allowing special characters. I&#039;m considering a port to mangoblog soon, will probably look at it then.</description>
		<content:encoded><![CDATA[<p>@Hem &#8211; Sorry about that, I must have a look into allowing special characters. I&#8217;m considering a port to mangoblog soon, will probably look at it then.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

Served from: chapter31.nfshost.com @ 2012-02-10 13:50:53 -->
