----- Original Message ----- From: "Bosky, Dave" <[EMAIL PROTECTED]> > Is there any benefit or performance difference when scoping local variables > or is it mainly used for readability? > <cfoutput>#Variables.myLocalVariable#</cfoutput> > <cfoutput>#myLocalVariable#</cfoutput> ----------------------------
I can't imagine there's any performance difference. The differences are down to personal preference, and accurate scoping. There's a pecking order if you don't scope a variable: 1. Arguments 2. Variables (local scope) 3. CGI 4. URL 5. Form 6. Cookie 7. Client <http://livedocs.macromedia.com/cfmxdocs/Developing_ColdFusion_MX_Applicatio ns_with_CFML/Variables7.jsp#1100240> This does mean that if you just say "#varName#", you'll invariably reference the right one, even if #URL.varName# exists as well. But maybe #Variables.varName# doesn't exist one time, but #URL.varName# does, and you don't notice the difference until one fateful day... That's the "worst-case scenario" argument for always scoping. The argument against, which often wins with me, is scope local vars all the time is a PITA! Gyrus [EMAIL PROTECTED] work: http://www.tengai.co.uk play: http://www.norlonto.net PGP key available ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

