One correction; var is for making local variables in functions and has
nothing to do directly with CFCs.

Matt Liotta
President & CEO
Montara Software, Inc.
http://www.montarasoftware.com/
888-408-0900 x901

> -----Original Message-----
> From: Rob Rohan [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 06, 2003 4:50 PM
> To: CF-Talk
> Subject: RE: CFC - Var vs. This
> 
> One is private and one is public.
> 
> For example, say you had a cfc that did encrypting. For some reason
you
> wanted to store the public key in the cfcomponent and use it in the
> function
> in that component. Further suppose you didn't want anyone to change /
see
> the key. If you used 'this' every one could 'see' the key, if you used
var
> you could use the variable inside the component and not allow it to be
> 'seen' or changed.
> 
> Hope that helps,
> 
> Rob
> 
> -----Original Message-----
> From: Adrocknaphobia Jones [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 06, 2003 1:41 PM
> To: CF-Talk
> Subject: RE: CFC - Var vs. This
> 
> 
> Right. But what's the difference outside of syntax. Would I want to
use
> one over the other? Why would I want to use var over this inside a CF
is
> this is much more flexible?
> 
> Adam Wayne Lehman
> Web Systems Developer
> Johns Hopkins Bloomberg School of Public Health
> Distance Education Division
> 
> 
> -----Original Message-----
> From: Matt Liotta [mailto:[EMAIL PROTECTED]]
> Sent: Monday, January 06, 2003 4:14 PM
> To: CF-Talk
> Subject: RE: CFC - Var vs. This
> 
> The two are very different. "this" is the public variable scope for a
> CFC instance. "var" is a keyword used to declare local function
> variables. "this" can be used anywhere inside a CFC. "var" can only be
> used immediately proceeding a function declaration or argument
> specification of a function declaration.
> 
> Matt Liotta
> President & CEO
> Montara Software, Inc.
> http://www.montarasoftware.com/
> 888-408-0900 x901
> 
> > -----Original Message-----
> > From: Adrocknaphobia Jones [mailto:[EMAIL PROTECTED]]
> > Sent: Monday, January 06, 2003 4:07 PM
> > To: CF-Talk
> > Subject: CFC - Var vs. This
> >
> > Alright,
> >
> > So Christian says to declare all of your private CFC variables at
the
> > top of the function like so <cfset var value = 1>.
> > Hal Helms recommends using <cfset this.value = 1>. Both obviously
> work,
> > but I'm wondering what the pros and cons are if any.
> >
> > Off the top of my head, it would seem that 'this' is more
functional,
> as
> > it acts like any other scope and can be dumped.
> >
> > Adam Wayne Lehman
> > Web Systems Developer
> > Johns Hopkins Bloomberg School of Public Health
> > Distance Education Division
> >
> >
> >
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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