[fpc-pascal] Interface syntax: Is possible don't use specialize in mode objfpc?

Sven Barth pascaldragon at googlemail.com
Thu Jul 16 22:26:43 CEST 2015

On 16.07.2015 19:21, Michael Van Canneyt wrote:
> The whole generics mess that Delphi made goes completely against the
> Pascal dictum that you must declare something before you can use it.
> To me, the above verbose construction makes absolute sense. It has been
> so since day 1:
> PRecord = ^TRecord;
> TRecord = record
>    a : integer;
>    next : PRecord;
> end;

For things like the following you can't use the "declare before use" 
paradigm however:

=== code begin ===

   generic ITest<T> = interface
     function Foo: T;

   generic TTest<T> = class(TInterfacedObject, specialize ITest<T>)
     function Foo: T;

=== code end ===


More information about the fpc-pascal mailing list