Having been away from Delphi during the "Generics revolution" and recently returning, I've been stumped by some of the seemingly weird limitations. Biggest one is functions/types used by a generic method having to be specified in the interface section of a unit.

Having been away from Delphi during the "Generics revolution" and recently returning, I've been stumped by some of the seemingly weird limitations. Biggest one is functions/types used by a generic method having to be specified in the interface section of a unit.

Then today I stumbled across this erronous error, which I guess confirms what I thought for some time, that the above inconsistencies are due to generics being implemented using the same infrastructure as code inlining.

Just coincidence or anyone know for sure one way or the other?

type
  TRec = record
    procedure Proc();
  end;
procedure TRec.Proc;
begin
  asm end; // E2426 Inline function must not have asm block
end;
begin
end.

Comments