>NO... there are no naming collisions. The only attributes are the field
names.


Yeah, there could be.  Consider this code:

<!--- c.cfc --->
<cfcomponent>
        <cffunction name="f">
                <cfset this.f = "fubar">
                <cfreturn "So far, so good">
        </cffunction>

        <cffunction name="g">
                <cfreturn "No worries">
        </cffunction>

</cfcomponent>


<!--- caller.cfm --->
<cfset o = createObject("component", "c")>
<cfoutput>
        #o.f()#<br />
        <cftry>
                #o.f()#<br />
                <cfcatch>
                        <cfdump var="#o#" label="It doesn't work because
you've overwritten the function f() with the string 'fubar'">
                </cfcatch>
        </cftry>
        <hr />
        #o.g()#<br />
        <cfset o.g = "more fubar">
        <cftry>
                #o.g()#<br />
                <cfcatch>
                        <cfdump var="#o#" label="It doesn't work because
you've overwritten the function g() with the string 'more fubar'">
                </cfcatch>
        </cftry>
</cfoutput>

So if you have a query column name that's the same as any of your public
method names... no good.  Hence my suggestion to put them in a separate
structure.

This method overwriting thing is an interesting quirk of CF.  Simultaneously
handy to know, but somewhat scary.  And probably not a very good "feature".
But no doubt it was designed that way, so it's fine ;-)

-- 
Adam


This email contains confidential information. If you are not the intended 
recipient of this email, please notify Straker Interactive and delete the 
email. You are not entitled to use it in any way.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]

Reply via email to