<?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: The VAR keyword is idiotic</title>
	<atom:link href="http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/</link>
	<description>Web Application Engineers</description>
	<lastBuildDate>Fri, 05 Mar 2010 10:00:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Darren Cook</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-425</link>
		<dc:creator>Darren Cook</dc:creator>
		<pubDate>Wed, 17 Oct 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-425</guid>
		<description>I tried the test suite out and found as others have that using var was definitely the fastest. However I was curious what performance was like for the &#039;var local = StructNew()&#039; and &#039;use the ARGUMENTS scope as a local scope&#039; ideas.  I enhanced the suite with tests for those, and found that they were quite a bit slower than using var, though still a smidge faster than using nothing.  I&#039;ll be choosing to use var then, as it&#039;s no worse a discipline to develop than scoping everything.</description>
		<content:encoded><![CDATA[<p>I tried the test suite out and found as others have that using var was definitely the fastest. However I was curious what performance was like for the &#8216;var local = StructNew()&#8217; and &#8216;use the ARGUMENTS scope as a local scope&#8217; ideas.  I enhanced the suite with tests for those, and found that they were quite a bit slower than using var, though still a smidge faster than using nothing.  I&#8217;ll be choosing to use var then, as it&#8217;s no worse a discipline to develop than scoping everything.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-421</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Tue, 06 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-421</guid>
		<description>I think the VAR keyword is most excellent. I like the idea of being able to define something as temporary to that function and that function only. Personally, I do what Dale Fraser does with the var LOCAL scope and that works great.

I also like to scope everything. That way, I can tell the difference between LOCAL scoped variables and ARGUMENTS scope variables that might have naming conflicts. 

To be honest, I think the best possible solution would be to make LOCAL a build in scope for all CFFunction scopes. Basically, build in the var LOCAL = StructNew() line of code. That way, you can still explicitly set something as being local, but no need to set up the scope. 

Not only does this save you a step, it make your code more understandable as it self-documents the availability of a variable. 

If we got rid of the VAR keyword, I suspect that it would be harder to tell where keywords were supposed to be available. Although I guess if you force the scoping of non-local variable, that would also help.</description>
		<content:encoded><![CDATA[<p>I think the VAR keyword is most excellent. I like the idea of being able to define something as temporary to that function and that function only. Personally, I do what Dale Fraser does with the var LOCAL scope and that works great.</p>
<p>I also like to scope everything. That way, I can tell the difference between LOCAL scoped variables and ARGUMENTS scope variables that might have naming conflicts. </p>
<p>To be honest, I think the best possible solution would be to make LOCAL a build in scope for all CFFunction scopes. Basically, build in the var LOCAL = StructNew() line of code. That way, you can still explicitly set something as being local, but no need to set up the scope. </p>
<p>Not only does this save you a step, it make your code more understandable as it self-documents the availability of a variable. </p>
<p>If we got rid of the VAR keyword, I suspect that it would be harder to tell where keywords were supposed to be available. Although I guess if you force the scoping of non-local variable, that would also help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Nelson</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-422</link>
		<dc:creator>Steve Nelson</dc:creator>
		<pubDate>Tue, 06 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-422</guid>
		<description>You can also use the arguments scope as a &quot;local&quot; scope. As far as i can tell it&#039;s thread safe and does not need to be declared in every function.</description>
		<content:encoded><![CDATA[<p>You can also use the arguments scope as a &quot;local&quot; scope. As far as i can tell it&#8217;s thread safe and does not need to be declared in every function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben Nadel</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-423</link>
		<dc:creator>Ben Nadel</dc:creator>
		<pubDate>Tue, 06 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-423</guid>
		<description>Steve,

Very true, and I have done that a bunch. The only time I can ever see that being a problem is when my arguments variable A and my local variable A have different meanings (in which case the two different scopes is needed). But again, that is a special case. 

When I do use the ARGUMENTS scope as a local scope, I tend to feel bad, like I am cheating, or misusing it... but I get over that and realize that ARGUMENTS is neither living nor does it have feelings :)</description>
		<content:encoded><![CDATA[<p>Steve,</p>
<p>Very true, and I have done that a bunch. The only time I can ever see that being a problem is when my arguments variable A and my local variable A have different meanings (in which case the two different scopes is needed). But again, that is a special case. </p>
<p>When I do use the ARGUMENTS scope as a local scope, I tend to feel bad, like I am cheating, or misusing it&#8230; but I get over that and realize that ARGUMENTS is neither living nor does it have feelings <img src='http://www.webapper.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Nelson</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-424</link>
		<dc:creator>Steve Nelson</dc:creator>
		<pubDate>Tue, 06 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-424</guid>
		<description>Yeah i agree. It does feel like cheating.

There also may be an issue with this during recursion. Specifically when overwriting an arguments scoped variable. Although I&#039;m not 100% sure about this.</description>
		<content:encoded><![CDATA[<p>Yeah i agree. It does feel like cheating.</p>
<p>There also may be an issue with this during recursion. Specifically when overwriting an arguments scoped variable. Although I&#8217;m not 100% sure about this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Kotek</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-396</link>
		<dc:creator>Brian Kotek</dc:creator>
		<pubDate>Mon, 05 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-396</guid>
		<description>I still have to admit that I don&#039;t understand what you are talking about at all, John. The only getters and setters I&#039;m familiar with in Java or C# are those written by developers.

If you want a read-only value for a CFC instance variable, you make the setter private and the getter public. This is not complicated. You can&#039;t make a variable private in the THIS scope because the THIS scope is public, just as it is in JavaScript. Still not understanding what the confusion is here.</description>
		<content:encoded><![CDATA[<p>I still have to admit that I don&#8217;t understand what you are talking about at all, John. The only getters and setters I&#8217;m familiar with in Java or C# are those written by developers.</p>
<p>If you want a read-only value for a CFC instance variable, you make the setter private and the getter public. This is not complicated. You can&#8217;t make a variable private in the THIS scope because the THIS scope is public, just as it is in JavaScript. Still not understanding what the confusion is here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Tong</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-397</link>
		<dc:creator>Nick Tong</dc:creator>
		<pubDate>Mon, 05 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-397</guid>
		<description>I agree that this is a pain at times and infact it&#039;s extra coding, but would adding this feature require extra parsing from the cf engine?  Surely there must be a reason why they require us to add the &#039;var&#039; manually... isn&#039;t there??</description>
		<content:encoded><![CDATA[<p>I agree that this is a pain at times and infact it&#8217;s extra coding, but would adding this feature require extra parsing from the cf engine?  Surely there must be a reason why they require us to add the &#8216;var&#8217; manually&#8230; isn&#8217;t there??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Kotek</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-398</link>
		<dc:creator>Brian Kotek</dc:creator>
		<pubDate>Mon, 05 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-398</guid>
		<description>Hey Steve, first, I&#039;ve heard this might be under consideration (either automatically or as a config option) in CF8. Remember, though, that this would break anyone&#039;s code who is relying on the existing behavior. For better or worse, Adobe is very careful when breaking backward compatibility.

Second, just to clarify, non-var scoped variables go into the variables scope of the containing CFC (they become instance data). So this is quite different than a &quot;global&quot; variable like the request scope. The two serve very different purposes. Just wanted to make sure other readers understand that!</description>
		<content:encoded><![CDATA[<p>Hey Steve, first, I&#8217;ve heard this might be under consideration (either automatically or as a config option) in CF8. Remember, though, that this would break anyone&#8217;s code who is relying on the existing behavior. For better or worse, Adobe is very careful when breaking backward compatibility.</p>
<p>Second, just to clarify, non-var scoped variables go into the variables scope of the containing CFC (they become instance data). So this is quite different than a &quot;global&quot; variable like the request scope. The two serve very different purposes. Just wanted to make sure other readers understand that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Nelson</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-399</link>
		<dc:creator>Steve Nelson</dc:creator>
		<pubDate>Mon, 05 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-399</guid>
		<description>Brain (I prefer that name over Brian)-

Yes it would break existing code if someone is making use of turning it off (not using it). That&#039;s why I ask the question &quot;do you ever want to NOT use it?&quot; 

I&#039;m not convinced anyone is NOT using it... on purpose. Plenty of people are not using it by accident. Like me. Whoops, I just found another one.</description>
		<content:encoded><![CDATA[<p>Brain (I prefer that name over Brian)-</p>
<p>Yes it would break existing code if someone is making use of turning it off (not using it). That&#8217;s why I ask the question &quot;do you ever want to NOT use it?&quot; </p>
<p>I&#8217;m not convinced anyone is NOT using it&#8230; on purpose. Plenty of people are not using it by accident. Like me. Whoops, I just found another one.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Kotek</title>
		<link>http://www.webapper.com/blog/index.php/2007/02/05/the-var-keyword-is-idiotic/comment-page-1/#comment-400</link>
		<dc:creator>Brian Kotek</dc:creator>
		<pubDate>Mon, 05 Feb 2007 00:00:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.webapper.net/blog/index.cfm/2007/6/29/The-VAR-keyword-is-idiotic#comment-400</guid>
		<description>Basically it would probably be anyone who wrote and deployed CFC code between 6.0 and the 6.1 release. I agree that there are probably not a lot of people, and further, in this case it might be worth it for Adobe to just say &quot;tough luck people, on this one you have to change your code&quot;. I sure wouldn&#039;t care if they did that.</description>
		<content:encoded><![CDATA[<p>Basically it would probably be anyone who wrote and deployed CFC code between 6.0 and the 6.1 release. I agree that there are probably not a lot of people, and further, in this case it might be worth it for Adobe to just say &quot;tough luck people, on this one you have to change your code&quot;. I sure wouldn&#8217;t care if they did that.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
