One thing that i did not like about FPC Generics is the impossibility of doing something like this :<br><br>Type
 <br>  generic TList<_T>=class(TObject)
 <br>    type public
 <br>       TCompareFunc = function(const Item1, Item2: _T): Integer;
 <br>    var public
 <br>      data : _T;
 <br>    procedure Add(item: _T);
 <br>    procedure Sort(compare: TCompareFunc);
 <br>  end;
<br><br>  generic TAdvancedList<_T>=Class(TList<_T>)<br>   procedure push(item: _T);<br>   function pop: _T;<br>  end;<br><br>  generic TOtherList<_T>=Class(TList<_T>)<br>    procedure enqueue(item: _T);<br>
    function dequeue: _T;<br>  End;<br><br>I dont think i explained it very well, the idea was that you cant have generic classes making part of the inheritance tree without specializing then 1st. This makes generics interfere (limiting it) with object oriented polimorphysm... having generics of generics would allow a complete STL capable of being changed (on the fly) into anything needed... (well, i might very well understood generics model wrongly)<br>
<br>one of the solutions i thought was something like this :<br><br>Type
 <br>  generic TList<_T>=class(TObject)
 <br>    type public
 <br>       TCompareFunc = function(const Item1, Item2: _T): Integer;
 <br>    var public
 <br>      data : _T;
 <br>    procedure Add(item: _T);
 <br>    procedure Sort(compare: TCompareFunc);
 <br>  end;
<br><br>  generic TAdvancedList<_T2> = Class(specialize(TList<_T2>))<br>     procedure Push(item : _T2);<br>     function Pop: _T2;<br>  End;<br><br>When the programmer makes :<br><br>Type<br>    TAdvancedListByte = specializeTAdvancedList<Byte>;<br>
<br>the compiler would automagically generate an intermediate TListByte that specializes TList<_T> (Replacing _T with _T2) and replace the original Class(specialize(TList<_T2>)) with Class(TListByte), all of this on the fly,  making intermediate classes to be part of the inheritance tree, and allowing a big generics library possible...<br>
<br>thats my two cents...<br>