On 7/10/07, Andrew Scott <[EMAIL PROTECTED]> wrote:
> Sean why are you so against this? I welcome this with great open arms...

Java needed interfaces because it is a statically typed language and
had chosen not to support multiple inheritance. It had no choice.

In ColdFusion, all type checking is done at run time. So if you use
interfaces, you will get a *runtime* check, just like all the other
checks. And if you screw up, you'll get a runtime error. If you use
interfaces, the error just has different text in it (OK, that's a
*slight* oversimplification :)

Furthermore, since CF is a dynamic language, you can change methods on
an object after constructing it, thus removing any guarantees that an
interface would buy you. You remove a method or simply replace a
method with a different signature. The interface no longer applies.

Then there's the actual details of how cfinterface performs its type
check. It requires that the function signatures match exactly, as do
the return types. That's not how interfaces work in statically typed
languages. An interface defines a constraining API, not an exact API:
you can specify arguments (in an implementation class method) that are
compatible with the interface method arguments (e.g., adding optional
arguments or using more permissive types). You can also specify more
constrained return types since those can't violate the interface
(i.e., an implementation method can return a subtype of the interface
method's return type).

Finally (thank god you say!), other dynamic OO languages don't have
interfaces - and don't need them. The only reason CF8 has interfaces
is to satisfy the CF-should-be-more-like-Java crowd. And, yes, I admit
I was the person who entered the original ER to add interfaces and,
yes, I whipped up support from the community. I regret that. I should
have left well alone. I've probably done more to cause the
CF-should-be-more-like-Java argument than anyone and that was a big
mistake on my part. I've seen the light now... I hope others do too...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 beta – Build next generation applications today.
Free beta download on Labs
http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:283363
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to