> Why is the naming not consistent?
> 
> For instance... Inside a cfcomponent tag you can have 
> functions (cffunction) yet when you publish this as a 
> web service you use
> http://someUrl/someDir/componentName.cfc?method=methodName  
> in the url. Why not call method function or function 
> method in the CFC....
> 
> I know this is picky, but is there a reason behind it?

Yes, I think there is.

A method is nothing more than a function that happens to be a member of an
object. This isn't specific to CF, but true in other languages as well. In
CF, actually, you can write a function and later assign it as a method of a
CFC, I think:

<cfcomponent hint="this component would be saved as foo.cfc">
        <cfset meaningoflife = "42">
</cfcomponent>

...

<!--- someotherpage.cfm --->
<cffunction name="getmeaningoflife" returntype="numeric">
        <cfreturn meaningoflife>
</cffunction>

<cfobject name="newfoo" component="foo">
<cfset newfoo.getmeaningoflife = Variables.getmeaningoflife>
<cfoutput>#newfoo.getmeaningoflife()#</cfoutput>

I think you can do something like this, but I haven't tested this specific
code.

This is how JavaScript works as well; functions are nothing more than
variables that contain code, really, and you can assign them to objects.
When you do this, the function is a method of that object.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to