[fpc-pascal] Implicit generic specializations

Ryan Joseph ryan at thealchemistguild.com
Sun Dec 2 14:57:44 CET 2018



> On Dec 2, 2018, at 8:11 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> Also the idea should be that a non-generic routine takes precedence. 
> 

I did this wrong then because the generic takes precedence now. Why shouldn’t the generic take precedence though? It comes after so you think it would hide the first one. The symbol “DoThis” is now a generic dummy (compiler term) so I didn’t know you could even get access to the first DoThis.

procedure DoThis(msg:integer);
begin
	writeln('DoThis:',msg);
end;

generic procedure DoThis<T>(msg:T);
begin
	writeln('DoThis$1:',msg);
end;

begin
	DoThis(1);	// DoThis$1:1
end.

Regards,
	Ryan Joseph




More information about the fpc-pascal mailing list