I have something along the same lines with interfaces, and i think it turned out pretty good. dont know how fast it is though, with TMethod.Invoke() and the extra method call.
But with a few macros to ease the creation of interface types its at least usable ;)
' this generates the type below
'Interface(ITable)
' IMethod( Lookup, :String, name:String)
'EndInterface()
Type ITable Extends TInterface
Field intf_Lookup:TMethod
Method Lookup:String(name:string)
Return intf_Read.Invoke( _intf_This, [name])
EndMethod
EndType
Type TTable {implements="ITable"}
Method Lookup:String( name:string)
Print "TTable.Lookup()"
EndMethod
EndType
Local obj:TTable= New TTable
Local intf:ITable = ITable( QueryInterface( obj, "ITable"))
If intf Then intf.Lookup("")
As you can guess, QueryInterface() does all the job of filling in the interface object with the proper TMethod objects,
so its really just a proxy... i want me some real shiny interfaces!