>- see footer for list info -<
Well here is one reason.

If you persist your CFC by storing it in session or application scope, then
everything you put in the THIS scope will also get persisted, thus taking up
memory. In the case of session, you will have a copy for each session.

If you don't persist then I can't see anything wrong with it.

Alternately u could put into request scope, or return it as WDXX.

Russ
 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gary F
Sent: 29 December 2005 13:10
To: [email protected]
Subject: [CF-Dev] The THIS scope in CFCs

>- see footer for list info -<
I posted a similar message on Ray Camden's Ask a Jedi blog but it created
more questions than answers. I need to return at least 2 complex objects
(queries) from a CFC. The CFRETURN function only lets you return a single
object/variable so I started using the THIS scope.

Example: from within the CFC
<CFSET this.myquery=myquery>

Now myquery is exposed to the parent page so I can grab it like so:

<!--- use createobject to initiate the cfc ---> <CFSET
objCFC=CreateObject("component","myCFC")>
<!--- collect a varible that CFReturn would usually return from a cfc --->
<CFSET getReturnedData=objCFC.myFunction("optional arguments go here")>
<!--- get the var/object that was explosed using the This scope ---> <CFSET
myquery=objCFC.myquery>

I found this is the quickest and most effecient way to return multiple
vars/objects from CFCs without storing them in arrays or structures which
seems like a waste of code when This works with total simplicity. Someone
told me using the This scope is bad practice but failed to give a reason. I
honestly don't see what's wrong with this, but I'd like to hear the thoughts
of experienced CFC users? (I've only been using CFCs for a few months).

Thanks,
Gary.
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help 
>-<


_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to