[fpc-pascal] Procedural generics question

Ryan Joseph genericptr at gmail.com
Wed Aug 26 14:59:02 CEST 2020



> On Aug 26, 2020, at 5:44 PM, Nico Neumann via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
> 
> generic procedure Add<T>;
> begin
>     if GetTypeKind(T) = tkInteger then WriteLn('an integer');
>     if GetTypeKind(T) = tkString then WriteLn('a string');
> end;

Question for the compiler team why doesn't the "is" operator work for types? We should be able to do:

if T is integer then
  ;

and get something which is well optimized.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list