I think it's helpful to have all the resources in one place. Indeed, ultimately I'll move this to my "resource lists" page where I keep similar "compendia".
I created the list of VAR scope resources today after helping a client with a problem which seemed related to this classic problem: the need to remember to var scope your variables in CFCs. It's often the cause of subtle bugs. Like many, they still hadn't heard about the problem (or had seen mention of it but didn't really understand it).
So if you're in that place, or know someone who may be, here are resources to help get started on understanding the topic and related issues. As always, the CF community has rallied the troops on the matter, and several folks have blogged in various detail or on various related aspects.
About the resources
The first few elaborate on the problem, and the first one even includes a live running example to demonstrate the point. Then a couple explain some related issues.
I also then list resources on the related new "local" scope in CF 9, and some more that discuss compatibility issues with that.
Note that these may have been written any time in the past couple/few years, so keep that in mind and be sure to check the comments as well.
First, some general resources introducing the var scoping issue/feature:
- Thread safety and the var scope - live example, by Mike Schierberl
- Memory Leaks: Part III - sessions and cfcs, Mike's previous blog entry discussing a memory leak he'd found related to CFCs (and perhaps the var scope) back in 2006
- Why precisely is it important to var-scope your variables?, by Nathan Strutz
- Thread safety example: Var scope your loop index in ColdFusion CFCs!, by Dave Shuck
- Object Oriented Coldfusion : 4 : The var scope, by Adrian Moreno
And some that address various issues related to using the VAR scope:
- Always var scope! Always!! Except..., by Ray Camden
- Var Scoping Queries, by Gary Gilbert (site was no longer responding, so using archive.org line)
- VAR scoping using structures, by Dave Shuck
- The VAR keyword is idiotic, by Steve Nelson
- The REAL reason you need to var-scope your local CFC function variables, by Tyson Vanek
And some on the change in CF9, for the local scope:
- The New ColdFusion LOCAL Scope, by Ben Forta
- Deciphering the new Local Scope, by Adam Tuttle
- Repeat - ColdFusion 9 does NOT remove the need to var scope!, by Ray Camden
And some tangential discussions of that, including some compatibility issues with the new scope:
- Be careful with the 'local' scope when migrating from CF8 to CF9, by Dan Skaggs
- CHF Warning - Impacts MXUnit, by Ray Camden (important impact of CF 9 CHF 1, even if not using MXUnit)
- LOCAL Variables Scope Conflicts With ColdFusion Query of Queries, by Ben Nadel
- Major Flaw in CF9 - May Break Code! and part 2/part 3, by Sami Hoda
The VarScope toolFinally, of course, as most of these resources point out, be sure to use Mike Schierberl's wonderful varscoper tool to help find whether you have instances of this problem. It tells you literally what to change, where, to don't let concern of this problem overwhelm you.
Hope those are helpful. Again, it's just a starting list. I welcome additions, and I look forward to your comments. In time, I'll move this (and any suggested additions) to my "resource lists" page. Check that out for similar lists of resources on various subjects.