Title:
[ANeff] ER for: UDF arguments for simple value types to coerce the value's type
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/AsDesigned
Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff ()
Created: 10/03/2017
Components: Language, Functions
Versions: 2016
Failure Type: Enhancement Request
Found In Build/Fixed In Build: CF 2016 /
Priority/Frequency: Normal /
Locale/System: /
Vote Count: 1
This ER is for: UDF arguments for simple value types to coerce the value's type
Example (using a "date" argument - but same would apply to any simple value type argument):
<cfscript>
tomorrow = now() + 1;
function doStuff(required date someDate) {//Since the type is "date" here, then the value's type should be coerced to coldfusion.runtime.OleDateTime
writeOutput(ARGUMENTS.someDate.getClass().getName() & ' ' & isValid("datetime_object", ARGUMENTS.someDate));
//Actual Result: java.lang.Double NO
//Expected Result: coldfusion.runtime.OleDateTime YES
writeOutput(ARGUMENTS.someDate.year());//throws "coldfusion.runtime.java.MethodSelectionException: The year method was not found."
}
doStuff(tomorrow);
</cfscript>
Issue: Per Adam's suggestion, if CF can coerce a UDF argument's value to match the argument's type, it should actually do the coersion.
Then, within the UDF, the appropriate member functions for that value's type can be used. Ex: In the above, there would be no error thrown when calling ARGUMENTS.someDate.year()
Attachments:
Comments: