Sorry for bringing up an old topic, but I could not help notice that Sean's code snippet of the "new way" to do things uses the "THIS" scope to store what seem like they would be private instance variables. Since it was Sean who taught me not to use "this" I figured I would ask: Have you started using "this" for your instance data? If so, why?
- Nathan > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Sean A Corfield > Sent: Wednesday, March 26, 2003 7:45 PM > To: [EMAIL PROTECTED] > Subject: Re: [CFCDev] Page context bug workaround > > [snip] ... > > New code: > <cfcomponent> > <cffunction name="loginUser"> > <cfargument name="username" type="string"> > <cfargument name="password" type="string"> > <cfset var userAuth = 0> > <!--- authenticate username/password ---> > <cfset this.username = arguments.username> > <cfset this.authlevel = userAuth> > ... > </cffunction> > </cfcomponent> > > Use: > <cfif not structKeyExists(session,"userInfo")> > <cfset session.userInfo = createObject("component","user")> > </cfif> > ... > <cfset session.userInfo.loginUser(uname,pword)> > ... > Hello #session.userInfo.username#! > > The user.cfc is no longer dependent on session scope so it can no > longer clash with other code that uses session scope directly, and it > can also be used to construct more complex user representations. (OK, > this may not be a very compelling example but the principle is sound > and can be applied elsewhere, for example a shopping cart CFC) [snip] ---------------------------------------------------------- You are subscribed to cfcdev. To unsubscribe, send an email to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' in the message of the email. CFCDev is run by CFCZone (www.cfczone.org) and supported by Mindtool, Corporation (www.mindtool.com).
