I've heard that in order for a variable only to exist within a specific function that you var scope it.
Correct.
However, they also say
that you don't reference the var scoped variable with the Variables scope
prefix.
Correct. 'var' scope is local to a function, 'variables' scope is an instance scope - it belongs to the whole CFC instance.
And that the variable scope prefix is Global within the CFC and not just the function.
Well, 'Global' is not really the right term but, yes, in essence you are correct.
But this is different than what is in regular CFML pages.
'var' scope doesn't exist in regular CFML pages - only inside UDFs / CFC methods.
Then
say you have a function with many lines of code and you don't reference your
Variables with the Variables scope, to me this makes the code hard to read.
If you always use 'variables' scope for your instance data then any un-scoped variables should be local 'var' scope variables.
So why then wouldn't regular CFML pages and CFCs work the same way regarding the Variables scope?
Mostly because 'variables' scope means something completely different in a CFML page to a CFC...
What are your thoughts on this?
I personally would not have chosen 'variables' as the scope name for non-public instance data (but then I wouldn't have chosen 'this' as the scope name for public instance data either).
Sean A Corfield -- http://www.corfield.org/blog/
"If you're not annoying somebody, you're not really alive." -- Margaret Atwood
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email.
CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
