[fpc-devel] generic and type compatibility / interface vs class ...

Martin Frb lazarus at mfriebe.de
Tue Feb 3 15:01:05 CET 2026


ok, so if I have
    procedure bar(f: IntfFoo);

I can do
    bar(SomeClassInstanceThatImplementsFoo);

makes sense, the interface can be gotten at the time of calling.

Now if I have

   generic MyGen<    P: IntfFoo >

then I can also do
   specialize MyGen<SomeClassInstanceThatImplementsFoo>

is that indented?

Because now if I have in MyGen

    FMyField: P;

and I try to assign an interface to it... Then that can't work.

Of course there are cases where it is the other way round, and may be 
useful.

------------------
Just trying to find out if that is a feature, or an issue that will 
eventually be changed?



More information about the fpc-devel mailing list