<div>Generics still have a lot of problems. I know they've been in the works for years but they still fail easily. Consider the Delphi mode below, I get "Error: Generics without specialization cannot be used as a type for a variable"</div>
<div><br></div><div>I could easily write up a whole bunch of test cases were generic still fail, both in Fpc and Delphi modes. If someone is considering working on the compiler to fix the problems with generics I can happily send them a bunch of test cases where the compiler currently fails.</div>
<div><br></div><div>{$mode delphi}</div><div><br></div><div>{ TEnumerator<T> }</div><div><br></div><div>type</div><div> TEnumerator<T> = class abstract</div><div> protected</div><div> function DoGetCurrent: T; virtual; abstract;</div>
<div> function DoMoveNext: Boolean; virtual; abstract;</div><div> public</div><div> property Current: T read DoGetCurrent;</div><div> function MoveNext: Boolean;</div><div> end;</div><div><br></div><div>{ TEnumerable<T> }</div>
<div><br></div><div> TEnumerable<T> = class abstract</div><div> protected</div><div> function DoGetEnumerator: TEnumerator<T>; virtual; abstract; // Error: Generics without specialization cannot be used as a type for a variable</div>
<div> public</div><div> function GetEnumerator: TEnumerator<T>;</div><div> end; </div>