Question
CFC's - VAR scoped or LOCAL scoped?
Ok, so I always thought it was good practice to VAR scope
your variables at the top of a CFC method so that it is thread
safe. Fair enough. However, I have just discovered today that you
can do this:
var LOCAL = StructNew();
// These are now all local.
LOCAL.Foo = 1;
LOCAL.Bar = QueryNew( "id" );
LOCAL.Test = StructNew();
Now, this looks like a REALLY nice method of doing it and I had never seen this before. I have written thousands of lines of code. Would it be worth changing it to this new method or shall I leave it as it is?
Will future CF versions have a problem with this method?
Thanks,
Mikey.
var LOCAL = StructNew();
// These are now all local.
LOCAL.Foo = 1;
LOCAL.Bar = QueryNew( "id" );
LOCAL.Test = StructNew();
Now, this looks like a REALLY nice method of doing it and I had never seen this before. I have written thousands of lines of code. Would it be worth changing it to this new method or shall I leave it as it is?
Will future CF versions have a problem with this method?
Thanks,
Mikey.
