I want to be able to create a TDictionary where the key is a string and the data is a class type. The idea is to allow the program to register types by name that will support an interface. I supply a base object type to support the interface and that type is a descendant of TInterfacedObject. This is to allow for ARC memory handling.
In usage the code would have a variable of the interface type and set it to the result of a function that is passed a name. That function would look up the name, create an instance of the associated type, and return the interface. When the code is done using the interface the ARC memory handling would automatically clean it up.
The compiler chokes on the following line:
fDictionary := TDictionary<String, TMyBaseType>.Create;
where TMyBaseType is defined as:
TBaseAncestor = class(TInterfacedObject, IMyInterface)
private
protected
function DoSomething : IResults; virtual; abstract;
public
end;
TMyBaseType = Type of TBaseAncestor;
The compiler error is:
[dcc32 Fatal Error] F2084 Internal Error: L2330
How can I work around this?