Status/Resolution/Reason: To Fix//Investigate
Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)
Created: 02/17/2015
Components: Language
Versions: 11.0
Failure Type:
Found In Build/Fixed In Build: CF11_Final /
Priority/Frequency: Normal / Few users will encounter
Locale/System: English / Platforms All
Vote Count: 1
See: http://blog.adamcameron.me/2013/07/question-for-yall-re-coldfusion.html
Given this interface:
~~~~
// IAdditionalOptional.cfc
interface {
public numeric function f(required numeric x);
}
~~~~
This CFC's f() method *does* fulfil the contract:
~~~~
// AdditionalOptional.cfc
component implements="IAdditionalOptional" {
public numeric function f(required numeric x, numeric y){
if (structKeyExists(arguments, "y")){
return x * y;
}else{
return x * 2;
}
}
}
~~~~
The requirement is that f() is defined and will take a numeric argument x. Which it does. Job done. Note that the y argument is *optional* so f(x[,y]) can indeed be used in any situation where f(x) is the requirements.
You're being too literal in what interface contracts are for, and overlooking that CFML has optional arguments.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3941525
External Customer Info:
External Company:
External Customer Name: Adam
External Customer Email:
External Test Config: My Hardware and Environment details:
Attachments:
Comments: