not unknown... obviosuly its known :-)  known as nothing!
That should read the unnamed scope.

Sorry If I confused matters...


----- Original Message ----- 
From: "Michael Tangorre" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Tuesday, June 10, 2003 1:32 PM
Subject: Re: CFC Newbie Discussion.


> Let me point out the scope bug...
>
> using "this" scope exposes your data members outside of the cfc. In
> addition, the varibales scope is not the default for not providing a scope
> within a CFC. There is something known as the "unknown" scope. This
unknown
> scope allows data members to be available to functions within the CFC...
not
> outside of.
>
> this.someVar would be accessible inside and outside of the CFC
> someVar would be accessible inside the CFC to the functions only.
>
>
>
> ----- Original Message ----- 
> From: "Ian Skinner" <[EMAIL PROTECTED]>
> To: "CF-Talk" <[EMAIL PROTECTED]>
> Sent: Tuesday, June 10, 2003 1:24 PM
> Subject: CFC Newbie Discussion.
>
>
> > I'm experimenting with my first CFC.  I've written these simple example
> > files.
> >
> > *** test.cfc ***
> > <cfcomponent displayname="My First CFC" hint="A trial CFC">
> > <cfset this.X = 10>
> > <cfset this.Y = 15>
> >
> > <cfset A = 5>
> > <cfset B = 3>
> >
> > <cffunction name="multiplyXY" access="public" returntype="numeric">
> > <cfset myResult = this.X * this.Y>
> > <cfreturn myResult>
> > </cffunction>
> >
> > <cffunction name="multiplyAB" access="public" returntype="numeric">
> > <cfset myResult = A * B>
> > <cfreturn myResult>
> > </cffunction>
> > </cfcomponent>
> > *** end ***
> >
> > *** test.cfm ***
> > <cfobject name="testObj" component="test">
> > <cfdump var="#testObj#">
> >
> > <cfset this.X = 12>
> > <cfset this.Y = 24>
> >
> > <cfset A = 21>
> > <cfset B = 32>
> >
> > <cfinvoke component="#testObj#" method="multiplyXY"
returnvariable="joe"/>
> > <cfinvoke component="#testObj#" method="multiplyAB"
returnvariable="sam"/>
> >
> > <cfinvoke component="test" method="multiplyXY" returnvariable="joe2"/>
> > <cfinvoke component="test" method="multiplyAB" returnvariable="sam2"/>
> >
> > <cfoutput>
> > #testObj.X# * #testObj.Y# = #joe#<br>
> > #testObj.X# * #testObj.Y# = #testObj.multiplyXY()#<br>
> > #this.X# * #this.Y# = #this.X * this.Y#<br>
> > <br>
> > #sam#<br>
> > #testObj.multiplyAB()#<br>
> > #A * B#<br>
> > <br>
> > #joe2#<br>
> > #sam2#<br>
> > </cfoutput>
> > *** end ***
> >
> > What I would like to discuss is the performance differences between the
> > various component methods I've tested here.
> >
> > In the CFC code, the X and Y variables are in the "this" scope and the A
> and
> > B variables are in the default "variable" scope.  What are the
differences
> > between these practices other then the X and Y are available as
properties
> > of an object (obj.X and obj.Y).
> >
> > Then in the CFM code I accessed the component a couple different ways.
I
> > first used a <cfobject> tag to "instantiate" an instance of the
component
> as
> > a object variable "testObj".  I then accessed the methods of that
instance
> > with a <cfinvoke> on testObj and directly [testObj.method()].  Finally I
> > just accessed the methods of the component directly with <cfinvoke>.
> >
> > I would like to discuss the pros and cons of these different practices
and
> > when one might be better then another.  Also, I remember reading about
> some
> > kind of scope bug involving CFC's, but since I wasn't really familiar
with
> > CFC's at the time, I really didn't understand what I was reading.  What
> > would this be about?
> >
> > Thank You
> >
> > --------------
> > Ian Skinner
> > Web Programmer
> > BloodSource
> > Sacramento, CA
> >
> >
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to