On Thu, 21 Apr 2022 10:00:46 +0200 (CEST) Michael Van Canneyt via fpc-pascal <fpc-pascal@lists.freepascal.org> wrote:
> On Thu, 21 Apr 2022, Hairy Pixels via fpc-pascal wrote: > > > > > > >> On Apr 21, 2022, at 3:48 AM, Mattias Gaertner via fpc-pascal > >> <fpc-pascal@lists.freepascal.org> wrote: > >>> Writeln(Apply(@StrFunc, 'Foobar')); // will write FOOBAR > >>> Writeln(Apply(@NegFunc, 42)); // will write -42 > >>> end. > >> > >> Mind boggling. :) > > > > This was actually your idea if I remember correctly. :) I think you > > said even Delphi doesn’t do this so I challenged myself to get it > > done. > > Delphi does it, but only for methods of a class. > > AFAIK delphi does not support generic "plain" functions. Delphi has generic methods and still no generic "plain" functions. Delphi 11 still does not support *nested* implicit specializations. For example the Apply with methods gives in Delphi: E2010 Incompatible types 'T' and 'String' F2084 Internal Error: AV10D0B8D2(10CB0000)-R800000000-0 Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal