ok...got it. so I really should ditch using this scope and just create my instance variables in the variables scope.

thanks


<html><div>--------------------------------------------- <BR>Steven Boynes <BR>580 37th Avenue<BR>San Francisco, CA 94121<BR>(530)574-2129 (Home/Mobile) <BR></div></html>




&gt;From: Jeffry Houser &lt;[EMAIL PROTECTED]&gt;
&gt;Reply-To: [EMAIL PROTECTED]
&gt;To: [EMAIL PROTECTED]
&gt;Subject: Re: [CFCDev] concerning this / variables scope in cfc
&gt;Date: Sun, 14 Nov 2004 21:03:23 -0500
&gt;
&gt;
&gt; variables.instance.varname will create a &quot;protected&quot; variable.
&gt;That means it can be accessed inside the CFC and by any descendants
&gt;of the CFC, however it cannot be accessed outside the CFC. ( Sean
&gt;described the difference between protected and private earlier in
&gt;this thread). The variable it creates is a structure named instance
&gt;with a key of &quot;varname&quot;. ( I assume most of your CFCs have more
&gt;than one instance variable of course... )
&gt;
&gt; this.variables.instance.varname will create a public variable.
&gt;That means it can be accessed from within the CFC, within its
&gt;descendants, and from outside the CFC. Unless I miss my guess, it
&gt;will create a structure called variables (probably not a good name
&gt;for a variable) with a &quot;key&quot; named instance. Instance is actually
&gt;another structure, which contains a key named varname.
&gt;
&gt;
&gt; so..
&gt;
&gt;variables.ThisVar cannot be accessed using
&gt;componentInstance.ThisVar
&gt;this.ThisVar can be accessed using componentInstance.ThisVar
&gt;
&gt; Make sense? I've never &quot;this&quot;, but I assume structures inside the
&gt;'scope' can be accessed in the same manner (
&gt;componentInstance.this.variables.instance.varname )
&gt;
&gt;
&gt;At 06:44 PM 11/14/2004, you wrote:
&gt;&gt;I didn't realize that the THIS scope was public, I used the
&gt;&gt;developer study guide as my reference and thought it referred to
&gt;&gt;the private scope of each instance of a CFC...
&gt;&gt;
&gt;&gt;I took an intro Java class and trying to put things to work in CF.
&gt;&gt;Previously I had placed all instance variables in the variables
&gt;&gt;scope, so basically at the top of the CFC I would declare
&gt;&gt;variables.instance.varname for each instance variable...and then I
&gt;&gt;decided to change it to this.variables.instance.varname... now I'm
&gt;&gt;confused, whats the difference?
&gt;&gt;
&gt;&gt;-Steve
&gt;&gt;
&gt;&gt;
&gt;&gt;---------------------------------------------
&gt;&gt;Steven Boynes
&gt;&gt;580 37th Avenue
&gt;&gt;San Francisco, CA 94121
&gt;&gt;(530)574-2129 (Home/Mobile)
&gt;&gt;
&gt;&gt;
&gt;&gt;
&gt;&gt;&amp;gt;From: Sean Corfield &amp;lt;[EMAIL PROTECTED]&amp;gt;
&gt;&gt;&amp;gt;Reply-To: [EMAIL PROTECTED]
&gt;&gt;&amp;gt;To: [EMAIL PROTECTED]
&gt;&gt;&amp;gt;Subject: Re: [CFCDev] concerning this / variables scope in cfc
&gt;&gt;&amp;gt;Date: Sun, 14 Nov 2004 09:01:45 -0800
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;On Sun, 14 Nov 2004 17:28:07 +0100, Magnus Wege
&gt;&gt;&amp;lt;[EMAIL PROTECTED]&amp;gt; wrote:
&gt;&gt;&amp;gt; &amp;gt; In the overview it is mentioned that you shouldn't use
&gt;&gt;the
&gt;&gt;variables scope
&gt;&gt;&amp;gt; &amp;gt; (&amp;quot;avoid using&amp;quot;).
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;That's very out-of-date as it refers to bugs in CFMX 6.0 that
&gt;&gt;have
&gt;&gt;&amp;gt;been fixed for two years (with CFMX 6.1).
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt; &amp;gt; Though Nando is right that the &amp;quot;this&amp;quot; scope is
&gt;&gt;available
&gt;&gt;to
&gt;&gt;&amp;gt; &amp;gt; the caller which breaks the encapsulation paradigm.
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;&amp;quot;this&amp;quot; scope is the equivalent to &amp;quot;public&amp;quot;
&gt;&gt;data
&gt;&gt;members - and all the
&gt;&gt;&amp;gt;literature out there will tell you not to use public data
&gt;&gt;members.
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;&amp;quot;variables&amp;quot; scope is the equivalent of
&gt;&gt;&amp;quot;protected&amp;quot;
&gt;&gt;data members. If
&gt;&gt;&amp;gt;your object needs state information, it will use
&gt;&gt;&amp;quot;variables&amp;quot;
&gt;&gt;scope.
&gt;&gt;&amp;gt;&amp;quot;variables&amp;quot; scope exists for the lifetime of the CFC
&gt;&gt;instance
&gt;&gt;(which
&gt;&gt;&amp;gt;depends on the scope in which the CFC instance itself is
&gt;&gt;stored).
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;&amp;quot;var&amp;quot; - not exactly a scope, but you should use it to
&gt;&gt;declare
&gt;&gt;any and
&gt;&gt;&amp;gt;all variables that should be local to a specific function call.
&gt;&gt;Such
&gt;&gt;&amp;gt;variables are created fresh for each function call and exist
&gt;&gt;only
&gt;&gt;&amp;gt;inside that function.
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt; &amp;gt; -----Urspr�ngliche Nachricht-----
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;And you really need to trim your posts...
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;[many hundreds of lines deleted]
&gt;&gt;&amp;gt;--
&gt;&gt;&amp;gt;Sean A Corfield -- http://www.corfield.org/
&gt;&gt;&amp;gt;Team Fusebox -- http://www.fusebox.org/
&gt;&gt;&amp;gt;Breeze Me! -- http://www.corfield.org/breezeme
&gt;&gt;&amp;gt;Got Gmail? -- I have 1 invite
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;&amp;quot;If you're not annoying somebody, you're not really
&gt;&gt;alive.&amp;quot;
&gt;&gt;&amp;gt;-- Margaret Atwood
&gt;&gt;&amp;gt;----------------------------------------------------------
&gt;&gt;&amp;gt;You are subscribed to cfcdev. To unsubscribe, send an email
&gt;&gt;&amp;gt;to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
&gt;&gt;&amp;gt;in the message of the email.
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;CFCDev is run by CFCZone (www.cfczone.org) and supported
&gt;&gt;&amp;gt;by Mindtool, Corporation (www.mindtool.com).
&gt;&gt;&amp;gt;
&gt;&gt;&amp;gt;An archive of the CFCDev list is available at
&gt;&gt;[EMAIL PROTECTED]
&gt;&gt;
&gt;&gt;
&gt;&gt;----------------------------------------------------------
&gt;&gt;You are subscribed to cfcdev. To unsubscribe, send an email
&gt;&gt;to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
&gt;&gt;in the message of the email.
&gt;&gt;
&gt;&gt;CFCDev is run by CFCZone (www.cfczone.org) and supported
&gt;&gt;by Mindtool, Corporation (www.mindtool.com).
&gt;&gt;
&gt;&gt;An archive of the CFCDev list is available at
&gt;&gt;[EMAIL PROTECTED]
&gt;
&gt;--
&gt;Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer
&gt;AIM: Reboog711 | Phone: 1-203-379-0773
&gt;--
&gt;My Books: &lt;http://www.instantcoldfusion.com&gt;
&gt;My Recording Studio: &lt;http://www.fcfstudios.com&gt;
&gt;My Energetic Acoustic Rock Band: &lt;http://www.farcryfly.com&gt;
&gt;--
&gt;When did Reality Become TV
&gt;
&gt;
&gt;----------------------------------------------------------
&gt;You are subscribed to cfcdev. To unsubscribe, send an email
&gt;to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
&gt;in the message of the email.
&gt;
&gt;CFCDev is run by CFCZone (www.cfczone.org) and supported
&gt;by Mindtool, Corporation (www.mindtool.com).
&gt;
&gt;An archive of the CFCDev list is available at
&gt;[EMAIL PROTECTED]



----------------------------------------------------------
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 [EMAIL PROTECTED]

Reply via email to