[fpc-pascal] Procedural generics question

Sven Barth pascaldragon at googlemail.com
Wed Aug 26 22:49:41 CEST 2020


Am 26.08.2020 um 14:59 schrieb Ryan Joseph via fpc-pascal:
>
>> 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.
Because there was simply no need for this.

Regards,
Sven


More information about the fpc-pascal mailing list