
ColdFusion
I’ve decided to keep track of my investigation into Railo after being brainwashed enlightened at SotR09 (London). I’ll post up about any issues I run into, comparisons and features that I think puts it above or below the level of Adobe’s CFML engine.
Named arguments in scoped functions
This has never worked in Adobe’s CFML and is something that I always thought would be useful. Especially considering that the same style syntax works perfectly well for CFC’s.
<cffunction name="foo" returntype="string" output="false"> <cfargument name="bar" type="string" required="true" /> <cfreturn 'Yes' /> </cffunction> <cfscript> st = StructNew(); st.foo = variables.foo; </cfscript> <cftry> <cfoutput>foo (no scope): #foo(bar = 'bob')#</cfoutput> <cfcatch type="any">No </cftry> <br /> <cftry> <cfoutput>variables.foo: #variables.foo(bar = 'bob')#</cfoutput> <cfcatch type="any">No</cfcatch> </cftry> <br /> <cftry> <cfoutput>st.foo: #st.foo(bar = 'bob')#</cfoutput> <cfcatch type="any">No</cfcatch> </cftry> <br /> <cftry> <cfoutput>variables.st.foo: #variables.st.foo(bar = 'bob')#</cfoutput> <cfcatch type="any">No</cfcatch> </cftry>
ColdFusion 7 + 8
foo (no scope): Yes
variables.foo: No
st.foo: No
variables.st.foo: No
Railo 3.1
foo (no scope): Yes
variables.foo: Yes
st.foo: Yes
variables.st.foo: Yes
Conclusion
I’ve filed this as a bug with Adobe and possibly even with Macromedia and they never acted on it. But Railo have gone along with common sense and made sure it was possible from the start. Support this syntax would allow you to, for example, store your own functions in the application scope and still retain the benefits of named arguments like optional ones.
Thanks Railo.