[fpc-pascal] generic proc inference

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Oct 7 16:19:32 CEST 2019


On Mon, 7 Oct 2019 09:51:47 -0400
Ryan Joseph <genericptr at gmail.com> wrote:

> Right now this gives an error because you can’t add normal functions
> AFTER generic functions with the same name in the same scope. I can’t
> find the bug report but I think Sven fixed this recently or gave a
> better error at least. 

I see.

>[...]
> That bug aside the rule is that non-generic overloads always win over
> generics. I remember this was discussed at length if we can find the
> old thread.

Note that in Delphi the "non-generic-wins" rule is per parameter:

procedure Run<T>(a:T; b: word);
procedure Run<T>(a: word; b: T);

Run(1,word(2)); // calls first
Run(word(1),2); // calls second
Run(1,2); // Error: ambiguous
Run(word(1),word(2)); // Error: ambiguous


Mattias


More information about the fpc-pascal mailing list