On Feb 22, 2004, at 1:01 PM, Marlon Moyer wrote:
Say with a CFC like this:

<cfcomponent>
            <cfset me = structnew()>
            <cffunction name=”init”>
            </cffunction>
</cfcomponent>

I can’t use the var keyword on the me structure, so will it be a shared instance among all instances of the CFC.  I’m trying to use this cfc in the session scope, and every session will have one of these cfc’s. 

So every session will have a variable inside the CFC called 'me' that exists for the lifetime of the CFC.


If that's what you want, it would be better practice to explicitly use 'variables' scope (equivalent to the unnamed scope you are using above):

        <cfcomponent>
                <cfset variables.me = structNew() />
                <cffunction name="init">
                </cffunction>
        </cfcomponent>

'var' only applies inside functions and makes a variable exist only for the duration of that function call (and only accessible inside that function).

Regards,
Sean

----------------------------------------------------------
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]

Reply via email to