On Mon, 7 Oct 2019 16:35:42 -0400 Ryan Joseph <generic...@gmail.com> wrote:
>[...] > procedure Run(a: integer; b: string); > begin > end; > > generic procedure Run<S,T>(a: S; b: T; c: integer); > begin > end; > > > // fails because the non-generic Run() will always be picked and the > parameter count will be wrong. Run(1,1,1); Yes, that works in Delphi. If you want to be better than Delphi, support this: {$mode objfpc} type TProc<T> = procedure(a: T); TAnt = class generic procedure Run<T: class>(a: TProc<T>); end; TBird = class end; generic procedure TAnt.Run<T>(a: TProc<T>); begin end; procedure Fly(Bird: TBird); begin end; var obj: TAnt; begin obj.Run(@Fly); // when fpc supports anonymous functions: obj.Run(procedure Fly(Bird: TBird) begin end); end. Mattias _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal