+1 for always scoping. Clearer to read, small performance gain, small security gain and why not.
On Wed, May 18, 2011 at 3:23 PM, Mike Chabot <[email protected]> wrote: > > Always scope your variables, unless you have a specific reason not to. It > reinforces a good habit and demonstrates to anyone reviewing your code that > you know what scoping variables is all about. I would estimate that roughly > 100% of experienced CF programmers would agree that scoping local variables > does more good than harm. Even though scoping local variables doesn't add > much value to the Web site, it does help separate you from the masses of > inexperienced CF programmers, and that is enough of a reason to do it. > > -Mike Chabot > On Wed, May 18, 2011 at 12:51 PM, Eric Roberts < > [email protected]> wrote: > > > > > We had a discussion at work as to whether or not we should scope local > vars > > with the "variables." scope since that is implied in a cfset. One camp > > says > > it is not needed because of the implicit scoping when using cfset...the > > other camp says it is better to tack on "variables." and make it explicit > > for security and readability. Any thoughts? > > > > Eric > > > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344629 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

