On 25/11/2025 14:19, Sven Barth via fpc-devel wrote:


Yes, because in fact they don't have the same name. The name of a generic with a single parameter is essentially "TFoo<>" while that of a generic with two parameters is "TFoo<,>".

The amount of generic parameters is part of the type or routine name.


Thanks, which just for confirmation brings up a follow up question. (I haven't used generic function much yet, so maybe I miss something)

          function  Foo   (aParam: Integer): integer;
  generic function  Foo<T>(aParam: t)      : integer;


Those are 2 different function too? (not an overload? because "T" could be integer in same cases)

Do you then always have to call the generic using
  specialize Foo<integer>(1)
?

I seem to remember a discussion about adding automatic specialization?
But then
  foo('abc') // would be clear, to specialize with string
but
  foo(1)  // could be either
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to