> >I think you mean putting code within the CFCOMPONENT tags, > but outside > >of any CFFUNCTION tags. > > Yes, this is commonly referred to as the "unnamed scope" in > CFCs, and is the > only true private scope (contrary to some posts on cf-talk > and elsewhere, > the "this" scope is not private as in Java).
Actually, I think most people call this the constructor area. The use of variables that are not arguments, this scoped, or var scoped, is called the unnamed scope. I'd like people to call it the Camden scope. :>
I just think that calling it the "constructor area" is dangerous because it suggests to those that are new to working with CFCs that there is a true concept of constructors, which there isn't. What people have implemented is merely a workaround for this absent (but coveted) feature. As far as I'm concerned the "Camden scope" is a better name because it doesn't suggest anything about that area that is not intended.
> >You are probably better off having another method in your > component (or > >somewhere) that is specifically called in each method rather than > >relying on the "constructor". Who knows, that behaviour > could change > >in a future version of CF. > > Relying on unintended features has bitten people in the past (i.e., > accessing the CF factory directly, which was subsequently > closed). I've > personally always found it best to rely on existing product features > (including both CF features and Java features) rather than > community-promoted "hacks," as that allows me to figuratively > point the > finger at Macromedia if the functionality is later changed or > deprecated.
While in general I'd agree, I think the Constructor concept, although technically a hack, is something that many CFC developers are using. I don't think it's dangerous to use at all.
And what happens if Macromedia introduces a concept of a constructor that does not mimic what many developers are using now? Personally, I don't think Macromedia should be tied down to current workaround practices (I'm not suggesting you said that, just making an observation) when and if they decide to introduce it as a feature in the next release. For example, if they eventually introduce the concept of a constructor as being a method with the same name as the CFC (comparable to Java), then the "constructor area" you refer to is no longer valid and becomes misleading. I never said it's dangerous, but I did say that you need to be careful about using unintended features.
Regards, Dave.
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail
----------------------------------------------------------
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).
