> Kind of, though I wouldn't make that comparison. My theory is 
> less than solid here so please someone patch where it is mistaken:
> 
> When ColdFusion processes a 'page' with a udf (either 
> cffunction or scripted 'function'); the function is parsed 
> and created as an
> *object* in memory (a special function type object). By 
> 'calling' the function without the () you are actually 
> referencing the object itself rather than invoking the 
> function that it represents.
> 
> So, the following code just makes the 
> application.udfs.MyFunction1 variable a reference to the 
> function named 'MyFunction1':
> 
> <cfset application.udfs.MyFunction1 = MyFunction1>
> 
> Make any sense?

This is a pretty good explanation, but it's even simpler than that.
Functions are really just one more type of variable, just like queries,
structures, arrays, etc. They contain executable code instead of data,
that's all. And, you're not "calling" the function unless you have the
parentheses after the function name:

<cfset myVar = someFunction()> <!--- this calls the function someFunction
and stores the return value in myVar --->
<cfset myVar = someFunction>   <!--- this creates another reference for the
value of someFunction, called myVar --->

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/

Fig Leaf Training: Adobe/Google/Paperthin Certified Partners
http://training.figleaf.com/

WebManiacs 2008: the ultimate conference for CF/Flex/AIR developers!
http://www.webmaniacsconference.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305678
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to