This will be one of those really quick ones as I have precisely 19min of lunchtime left to write it.
Ryan Guill found some oddness with Railo yesterday, with code like this:
function tikiOtinga(required string s required numeric i){
writeDump(arguments);
}
(his example wasn't in Maori, but hey).
Can you spot what's wrong with it?
Here's a call to the function, and its output:
function tikiOtinga(required string s required numeric i){
writeDump(arguments);
}
tikiOtinga("Whā tekau mā rua", 42);
writeDump(getMetadata(tikiOtinga));
Erm hello?
OK, look more closely and the function spec:
function tikiOtinga(required string s required numeric i)
It's missing a comma.
So how does this even compile, and what is it doing? The same code on CF gives predictable results:
The following information is meant for the website developer for debugging purposes. | ||||||||
Error Occurred While Processing Request | ||||||||
|
This is correct behaviour in my view.
Ryan was puzzled, but he found ticket RAILO-2638, in which Micha says this:
Thx for the input and the effort for this ticket, but i'm sorry, i have to disagree.This is nonsense, IMO. Not least of all because the last statement is not correct: CF baulks at this.
This way you simply declare hints.
add the following to your testcode and you will see:
dump(getMetaData(a));
you define named hints without a value, do the following code and it will be even more clear
<cfscript>
function a (numeric a,numeric b,numeric c numeric="Susi" d="Sorglos",numeric e)
{ writeDump(arguments); }
writedump(getMetaData(a));
</cfscript>
btw: ACF acts exact the same way
What Micha means is that one can specify additional metadata against arguments (although doing it this way is quite crap, but that is a story for another day), but - on ColdFusion anyhow, it knows an error when it sees it: one cannot have metadata keys that are "reserved" values.
This simply should not compile.
Note: this doesn't compile even on Railo:
<cffunction name="tikiOtinga">
<cfargument required="true" type="string" name="s" required="" numeric="" i="">
</cffunction>
(which is directly analogous to the script version).
I think whilst one might be able to specify additional metadata fields on an argument, one should not be permitted to use keywords as their names in this context.
CF gets it right: Railo gets it wrong.
Thoughts?
--
Adam