tracker issue : CF-3558904

select a category, or use search below
(searches all categories and all time range)
Title:

Interface support for mix-ins

| View in Tracker

Status/Resolution/Reason: To Fix/Deferred/Investigate

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron (Adam Cameron)

Created: 05/13/2013

Components: Language

Versions: 2016,11.0,10.0,2018

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Win XP All

Vote Count: 0

Extracted from http://adamcameroncoldfusion.blogspot.co.uk/2013/05/interface-inheritance-what-one-can-and.html

[...] Sean put me onto an interesting one here. Consider this code:

// Testable.cfc
interface {
       void function f();
}

// Bare.cfc
component {

}

// test.cfm

bare = new Bare(); // at this point, this is an empty object

void function f(){
       // this is the function that Testable.cfc requires
}

bare.f = f;    // now bare fulfills the contract requirements of Testable.cfc

// this function requires an argument which is a Testable
void function test (required Testable o){
}

test(bare);    // bare should fit the bill now, but this line will error

There's an argument to be had that given CFML is loosely type, and that it as well allows mix-ins, then this code should work. By the time bare is used, it is actually a completely valid Testable object. However CF will error when Bare.cfc is first compiled (up on the first line):

The O argument passed to the test function is not of type Testable.

This is probably incorrect behaviour for a dynamic language like CFML.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3558904

External Customer Info:
External Company:  
External Customer Name: Adam Cameron.
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

This needs to be thought off well. Punting it for the time being and we will consider it for the next release.
Comment by Rupesh K.
15434 | September 05, 2013 07:16:49 AM GMT