> On Nov 20, 2022, at 4:26 AM, Sven Barth via fpc-pascal 
> <fpc-pascal@lists.freepascal.org> wrote:
> 
> // this kind of constraint that uses T does not work yet
>   generic TList<T; Comparer: specialize TComparer<T>> = class
>     procedure Sort;
>   end;

Does this mean the generic param “Comparer” has a constraint which is 
"specialize TComparer<T>”? I’ve not ever considered this before but I think it 
solvers the problem where I suggested you could use something like traits. What 
is the challenge involved in implemented that so that it hasn’t been done yet? 
Just curious. :)

And related since it comes to mind now, what is the reason generics inside of 
generics (like a generic method inside a generic class) are not supported and 
what challenges are involved? 

Seems like generics are maybe lacking some ability of recursion or something…

Regards,
Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to