> But compiler should knows that the variable declarations (with cfset) > within a cffunction are local no?
How, unless you've told it that the variable you're setting is local to the function? Once you tell it "this variable is local", then it'll remember, but you have to tell it that at some point. <cfset var myVar = 3 /> <cfset myVar = 4 /> <cfset myOtherVar = 4 /> Obviously the first two lines set a local function variable. THe first one does double duty in that it also tells CF that 'myVar' is local to the function. The third line, however, is unclear. We haven't told CF that "myOtherVar" is local to the function, nor have we told it that it's local to the CFC instance. Which one is it? That's why we need the 'var' keyword. cheers, barneyb On Sat, 4 Sep 2004 01:13:32 +0200, Xavi <[EMAIL PROTECTED]> wrote: > But compiler should knows that the variable declarations (with cfset) > within a cffunction are local no? > > On Fri, 3 Sep 2004 15:26:32 -0700, Barney Boisvert <[EMAIL PROTECTED]> wrote: > > how else are you going to differentiate between setting a local > > variable and a non-local variable? And remember that we need that for > > UDFs as well as CFC methods. Declaring them at the beginning of the > > function is a bit of a pain, but not a whole lot. > > > > cheers, > > barneyb -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the words '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]
