G'day
I've just been comparing some behaviour between CF8 & OBD vis-a-vis
interface support. First: oh *thanks* to whichever vendor implemented
this second, for not following the lead of whoever implemented it
first. Inspired, that. I suspect it was Adobe who dropped the ball
there.
Anyway, I've dealt with that (using a runtime mapping which points to
a different dir for the interfaces, depending on platform... yuck)...
so here's the OBD issue...
It seems to me that all OBD supports in regards to interfaces is that
a CFC that implements an interface must implement whatever methods the
interface dictates, but it doesn't care about much beyond that. It
doesn't seem to care about method return types and required arguments,
which - I think - are kinda the bread and butter of what an interface
is supposed to define.
Here's my test code, in case I'm doing anything bung:
<!--- IOptArgs.cfc --->
<cfcomponent type="interface">
<cffunction name="f" returntype="boolean">
<cfargument name="reqdArg" type="numeric" required="true">
</cffunction>
</cfcomponent>
<!--- OptArgs.cfc --->
<cfcomponent implements="IOptArgs">
<cffunction name="f" returntype="any">
<cfargument name="reqdArg" type="string" required="false">
<cfargument name="optArg" type="string" required="false">
<cfreturn true>
</cffunction>
</cfcomponent>
<!--- optArgs.cfm --->
<cfset o = createObject("component", "OptArgs")>
<cfoutput>#o.f(reqdArg=1)#</cfoutput>
See how the method signature for f() in the component returns ANY,
whereas it should return a BOOLEAN? Also the implementation of f()
specifies reqdArg as an optional string arg, not a required numeric
arg. Plus I have specified an additional argument not mentioned in
the interface at all.
Yet the test code still runs fine.
:-(
Am I missing something?
Cheers.
--
Adam
--
Open BlueDragon Public Mailing List
http://www.openbluedragon.org/ http://twitter.com/OpenBlueDragon
online manual: http://www.openbluedragon.org/manual/
mailing list - http://groups.google.com/group/openbd?hl=en