ColdFusion CFInvoke Eliminates The Need For Evaluate() When Dynamically Executing User Defined Functions

<!--- Loop over the display functions. --->
<cfloop
	index="strMethod"
	list="GetDisplayName,GetInverseDisplayName,GetInformalDisplayName"
	delimiters=",">
 
	<!--- Get the meta data for the current method. --->
	<cfset objMetaData = GetMetaData( VARIABLES[ strMethod ] ) />
 
	<!--- Invoke the given method. --->
	<cfinvoke
		method="#strMethod#"
		returnvariable="strName">
 
		<!---
			Check to see if there are PARAMETERS for this method.
			If there are none, then our target function does not
			have defined arguemnts and we have to use index
			arguments.
 
			NOTE: We could *always* use INDEX arguments, but I
			am performing this check to demonstrate the dynamic
			nature of ColdFusion (woohooo!).
		--->
		<cfif ArrayLen( objMetaData.Parameters )>
 
			<!---
				There are parameters so use the named arguments
				made available in our meta data.
			--->
			<cfinvokeargument
				name="#objMetaData.Parameters[ 1 ].Name#"
				value="Ben"
				/>
 
			<cfinvokeargument
				name="#objMetaData.Parameters[ 2 ].Name#"
				value="Nadel"
				/>
 
		<cfelse>
 
			<!---
				There are no parameters so we have to use the
				index-based arguments.
			--->
			<cfinvokeargument name="1" value="Ben" />
			<cfinvokeargument name="2" value="Nadel" />
 
		</cfif>
 
	</cfinvoke>
 
 
	<!--- Output result. --->
	<p>
		<strong>#strMethod#</strong>: #strName#
	</p>
 
</cfloop>

For Cut-and-Paste