Mattias Gaertner via fpc-pascal <fpc-pascal@lists.freepascal.org> schrieb
am Mo., 25. Apr. 2022, 13:50:

>
> >[...]
> > type
> >   generic TArrayHelper<T> = type helper for array of T
> >     procedure Add(value: T);
> >   end;
> >
> > var
> >   a: array of integer;
> > begin
> >   a.Add(1);  // specialize TArrayHelper<Integer> since the compiler
> > clearly knows the type used is Integer. end.
>

For some reason I don't get all mails by Ryan, so I reply here:

Helpers currently can't be generic and even if they could be (which I do
plan to add) it would require an explicit specialization of the helper to
be used because the compiler will not be tasked with searching for
potential generic helpers and then implicitly specializing a whole helper
type with all its methods to maybe use it for an implicit specialization
(and it needs to specialize the helper first to decide whether it even
remotely contains suitable methods).

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

Reply via email to