Delegate implementation of Interface

I’m trying to use delegates to implement an interface. But if I check if the “base” class implements the interface, returns false.

Something like:

IMemory.cfc

interface  {
  function read();
}

ramMemory.cfc

component implements="IMemory" {
  
   function read(){
      return "hello";
   }
}

Computer.cfc

component {

  property name="rammemory" inject delegate;

}

This return false: isInstanceOf( mycomputer, 'IMemory')

Is there a way to check if the computer instance implements the Imemory interface even if it is by a delegate?

Hi @David_Sedeno unfortunately in CFML this will not be possible. Because the delegations are done AFTER the components are compiled. Meaning that the interface implementations at the byte code level is not there and cannot be altered in CFML.

Now, with that said, we are already starting the delegations/traits spec for BoxLang, to allow this at the bytecode level.