Here is a simple example:

You call method A in the CFC. Method A has a variable called X. Method A
calls method B, which also has a variable X. If they are not var scoped,
then they can overwrite each other.

So - you don't have a danger of stuff leaking into the calling template,
but inter-CFC action can go to heck if you forget to VAR scope.

=======================================================================
Raymond Camden, ColdFusion Jedi Master for Macromedia

Email    : [EMAIL PROTECTED]
Yahoo IM : morpheus

"My ally is the Force, and a powerful ally it is." - Yoda 

> -----Original Message-----
> From: Patti G. L. Hall [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, July 17, 2002 4:05 PM
> To: CF-Talk
> Subject: Question: Var when writing components
> 
> 
> Now, I know that when you are writing a UDF you use var to 
> scope all local udf variables, keeping them from existing in 
> the variables scope of the calling page.  I have physically 
> seen this behavior in my tests.  But... What I'm not 
> understanding is if var is necessary in the same way or for 
> the same reasons when writing components.  I know Raymond 
> says it is so... And I'm not suggesting he's wrong, I'd just 
> like to know why.
> 
> When I write a component and do not use var the local 
> variables in my component stay local to the component... I 
> can't examine them when I'm viewing the variables scope on 
> the calling page.  Is there a reason (other than good form) 
> to use var when building a component?  I believe that in 
> flash var-ing variables actually saves memory space in that 
> the variables are destroyed when the function ends...
> 
> -Patti
> 
> 
______________________________________________________________________
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
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to