[Pas2js] How I do it?

Sven Barth pascaldragon at googlemail.com
Mon Feb 14 05:35:29 CET 2022


Am 11.02.2022 um 11:22 schrieb Michael Van Canneyt:
>
>
> On Fri, 11 Feb 2022, Henrique Gottardi Werlang wrote:
>
>> I'm having a question of how to declare some generic functions in FPC.
>>
>> At Delphi I declare them like this:
>>
>> type
>>  TProc = reference to procedure;
>>  TProc<T> = reference to procedure (Arg: T);
>>  TProc<T1, T2> = reference to procedure (Arg1: T1; Arg2: T2);
>>
>> How do I make an equivalent statement in FPC?
>
> You can't, currently, in ObjFPC mode.
>
> We're coordinating with the FPC compiler team. They forbid it to allow 
> omitting the <t> in method implementations.

To be slightly more accurate: it was forbidden, because it wasn't known 
at the time that it would be possible - FPC generics came before Delphi 
ones.

Regards,
Sven


More information about the Pas2js mailing list