[Pas2js] How I do it?

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Feb 11 12:18:42 CET 2022


On Fri, 11 Feb 2022 11:22:51 +0100 (CET)
Michael Van Canneyt <michael at freepascal.org> wrote:

> 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.

Currently you must put them in a unit with mode delphi.
You can specialize them in both modes. 
 
> We're coordinating with the FPC compiler team. 
> They forbid it to allow omitting the <t> in method implementations.
> 
> As far as I understood, it should work in Delphi mode; but I didn't
> check that.

Yes, they work in main, but are not yet well tested.

Mattias


More information about the Pas2js mailing list