Status/Resolution/Reason: Closed/Fixed/Fixed
Reporter/Name(from Bugbase): Luis Majano / Luis Majano (Luis Majano)
Created: 10/10/2013
Components: Language, Closures
Versions: 10.0
Failure Type: Enhancement Request
Found In Build/Fixed In Build: Final / CF13 Final
Priority/Frequency: Trivial / All users will encounter
Locale/System: English / Platforms All
Vote Count: 12
Problem Description:
I found this shocking that I could not declare closures outside of cfscript or script only components. I find this a typical half way there in the language. Why can't I declare a closure using cfset???
What If I am in tags and need to pass in a closure to some CFC or native coldfusion function. I can't! This really needs to be addressed.
Steps to Reproduce:
{code:java}<cfset c = function()
{ return true;}>
{code}
{code:java}
<cffunction name="Foo" returntype="function">
<cfargument name="arg1" required="false" default="foo" type="string">
<cffunction name="Bar" returntype="string">
<cfargument name="arg2" required="false" default="bar" type="string">
<cfreturn arguments.arg1 & " " & arguments.arg2 />
</cffunction>
<cfreturn Bar />
</cffunction>
<cfset foo = Foo("foo") />
<cfset foobar = foo("bar") />
{code}
Declaring any closure in any non-cfscript context.
Actual Result:
Expected Result:
Any Workarounds:
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3648781
External Customer Info:
External Company:
External Customer Name: LuisMajano
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: