Hi

I like Patrick's Example CFC , but i think it needs a tweak to incorporate cliffs note about the local psuedo scope.

<cfcomponent>
 <cfset variables.private = "A private instance variable">
 <cfset this.public = "A public instance variable">
 <cffunction name="foo">
   <cfargument name="anArgument">
   <cfset var local = structNew() >
   <cfset local.FooVar = "Available within the scope of this function">
   <cfoutput>
     You passed me: #arguments.anArgument#
     I have a local var whose value is: #local.FooVar#.
     I have an private instance variable whose value is #variables.private#.
     I have an public instance variable whose value is #this.public#.
   </cfoutput>
 </cffunction>
</cfcomponent>

if you dont stick variables in any other scope apart from these you will be fine.

Now i know that COOKIE, SESSION, REQUEST and APPLICATION are all available to CFC's ...but for anyone who is new to coding with cfcs ...just pretend they dont exist. that rule should proly apply to everyone not just people new to cfc's but im sure there is some justification for using them now and again.

My 2c (1c borrowed from patrick and 1c borrowed from cliff)

Pat


On 11/11/05, Phillip Senn <[EMAIL PROTECTED]> wrote:
Wow!
And Thank you!
Loved the pictures by the way.


-----Original Message-----
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf
Of Jim Davis
Sent: Thursday, November 10, 2005 12:28 PM
To: [email protected]
Subject: RE: [CFCDev] Scoping


It may address your need because I need to update it with more information
about CFCs, but I've a somewhat detailed overview of this (and other
variable-related) topics here:

http://www.depressedpress.com/Content/Development/ColdFusion/Guides/Variable
s/Index.cfm




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to [email protected] with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/[email protected]

Reply via email to