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@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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to