Is it impossible to re-export generic interfaces in Delphi? The code below won't compile:

Is it impossible to re-export generic interfaces in Delphi? The code below won't compile:

//Unit1.pas
unit Unit1;

interface

type
MyInterface = interface
end;

implementation

end.

//Unit2.pas
unit Unit2;

interface

uses
Unit1;

type
MyInterface = Unit1.MyInterface;

implementation

end.

When compiling it gives the following errors:
[dcc32 Error] Unit2.pas(9): E2508 Type parameters not allowed on this type
[dcc32 Error] Unit2.pas(9): E2029 Declaration expected but ';' found

My googling has failed me here. It doesn't seem to work for generic classes either.

Comments

  1. You cannot have an alias to a generic type - maybe Allen Bauer knows the technical reason behind this.

    ReplyDelete
  2. Stefan Glienke OK, thanks. Not happy about that, though.

    ReplyDelete

Post a Comment