Ray and I have done quite a bit of testing with this. You do still need to use var when creating local variables in methods of components, but not to protect them from the caller page's variables scope. You need to use var to make variables private from other functions. If you call a component method from another component method, variables exist in the same local "instance" scope and will overwrite each other - if you don't declare them with "var" (<CFSET var foo="Hello Patty">).
~Simon Simon Horwith Macromedia Certified Instructor Certified Advanced ColdFusion 5 Developer Fig Leaf Software 1400 16th St NW, # 500 Washington DC 20036 202.797.6570 (direct line) www.figleaf.com -----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 ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists