I was a bit surprised about the "this" scope working in the CFM file as
well.  It did just create local variables that are different then the
variables in the component object.  So they make a kind of perverted sense
if you think of the caller page as an object in it self.  I wonder if they
are different then "variables" scoped variables on the same page.  I'll try
that.  

Thanks for the link, I now understand what the "scope" bug is about.  I'll
experiment with it to get an understanding.

--------------
Ian Skinner
Web Programmer
BloodSource
Sacramento, CA


-----Original Message-----
From: jon hall [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 10, 2003 11:01 AM
To: CF-Talk
Subject: Re: CFC Newbie Discussion.


<cfobject name="testObj" component="test">
<cfdump var="#testObj#">

<cfset this.X = 12>
<cfset this.Y = 24>

This part confuses me...this scoped variables refer to the object they
are contained within. It looks like you are setting them outside of a
cfc. All that will do is create a structure called this, which
contains x and y keys, its odd it works in the first place. I would
think this should be a reserved word in MX. Hrm.

Otherwise it's really personal preference on how to invoke your
methods. It really depends on what they return, if anything. Like
Michael I prefer createObject() for instantiating cfc though. Same
code in cfml and cfscript, plus it's just less typing.

The only big scope issue to me is the variables scope inside a cfc
being available outside of it. This could be fixed in the upcoming
release though...no way of knowing without joining the beta program
though I guess.
http://cfguru.daemon.com.au/archives/000067.html

-- 
 jon
 mailto:[EMAIL PROTECTED]

Tuesday, June 10, 2003, 1:24:50 PM, you wrote:
IS> I'm experimenting with my first CFC.  I've written these simple example
IS> files.
<snip>

IS> What I would like to discuss is the performance differences between the
IS> various component methods I've tested here.  

IS> In the CFC code, the X and Y variables are in the "this" scope and the A
and
IS> B variables are in the default "variable" scope.  What are the
differences
IS> between these practices other then the X and Y are available as
properties
IS> of an object (obj.X and obj.Y).

IS> Then in the CFM code I accessed the component a couple different ways.
I
IS> first used a <cfobject> tag to "instantiate" an instance of the
component as
IS> a object variable "testObj".  I then accessed the methods of that
instance
IS> with a <cfinvoke> on testObj and directly [testObj.method()].  Finally I
IS> just accessed the methods of the component directly with <cfinvoke>. 

IS> I would like to discuss the pros and cons of these different practices
and
IS> when one might be better then another.  Also, I remember reading about
some
IS> kind of scope bug involving CFC's, but since I wasn't really familiar
with
IS> CFC's at the time, I really didn't understand what I was reading.  What
IS> would this be about?


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

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

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

Reply via email to