[fpc-pascal] Generic type declaration example versus manual.

Pascal sur.pignard at wanadoo.fr
Sun Nov 22 21:17:47 CET 2009

Hello Anthony.

Thanks for your proposal.
I'm a bit surprised of Delphi chosen syntax because  
"TList<T>=class ..." breaks Pascal usual type declaration
"Id=type;" and "<T>=" may be confused with greater or equal operator.

Have you some documentation available on Internet?
The one I found is Delphi Object Pascal Language Guide, version 7, 2002.
Generic types are not described in it ;-(

Best, Pascal.

Le 22 nov. 09 à 12:00, fpc-pascal-request at lists.freepascal.org a écrit :

> From: Anthony Walter <sysrpl at gmail.com>
> Subject: Re: [fpc-pascal] Generic type declaration example versus
> 	manual.
> I haven't used generics in FPC, but really have to ask, is they
> keyword generic really necessary? Shouldn't generics be declared like
> this:
> type
>   TList<T> = class
>   private
>      ...
>   public
>     function Add: T;
>     procedure Remove(Item: T);
>     property Item[Index: Integer]: T read Get write Put; default;
>   end;
> I believe this makes the most sense, and it's also how they are
> declared in Delphi.
> It would be a real shame to create more Delphi incompatibilities.

More information about the fpc-pascal mailing list