Let's clarify what is going on here with the "THIS" scope. THIS is a reference to the public scope of the CFC. Thus, it's no surprise that private/package methods cannot be referenced in the THIS scope. That was also true in 6.0. One rule of thumb: any time you are referencing something in the "THIS" scope it's probably true that you are doing something you either a) do not have to do, or b) should not do -- "b)" is particularly true if you are referencing variables in the this scope because it means you are putting your instance data into the public scope, which is typically not something you want to do (one exception that some people use here is the use of "constants" such as named flags that are used as arguments of methods).
You should be able to reference ALL methods of a CFC inside of itself unscoped -- I have found that to be my preferred way to reference an internal method. The VARIABLES scope inside a CFC is a bit more confusing. For implementation reasons I do not fully understand, the developers of CF decided that the VARIABLES scope should contain all methods of the CFC regardless of access type. If you dump the VARIABLES scope you will also see that it contains "THIS". I would consider both of those facts to be implementation details that you should ignore. In other words, I personally don't think, mostly for style reasons, that referencing methods prefixed with "variables." makes much sense. I'd also hate to see "variables.this.", but that would work as I understand it. Hope that helps clarify the behavior you experienced. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Behalf Of Nando > Sent: Saturday, November 08, 2003 10:17 PM > To: [EMAIL PROTECTED] > Subject: RE: [CFCDev] Problems with Oracle sequence in CFC > > > don't you just hate those? sounds like Nat's tear it down debug > approach is > the way to go. > > but messing around with a working component, here are a few interesting > things i've found. > > unscoped, this scoped, and variables scoped calls to a public > method in the > same cfc all work. > But, a this scoped method call to a private method in the same cfc will > fail - > > <cfset this.setInstanceMemento(QueryRowToStruct(thisText)) /> (with > setInstanceMemento set to private ...) > > "The method 'setInstanceMemento' could not be found in component > ..." > > which is somewhat counter intuitive, but makes sense in a way if you think > about it. Chalk one more up to the evils of the this scope. > > but a variables scoped or unnamed scope method call to a private method in > the same cfc works. > > i read somewhere a sentence that said "You can call methods > within the same > cfc using the this scope." and the author implied it only works if you use > the this scope, hence my previous inaccurate post. Maybe that was true in > 6.0. ---------------------------------------------------------- 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). An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]
