Martin Frb via fpc-devel <fpc-devel@lists.freepascal.org> schrieb am Do., 9. Dez. 2021, 00:15:
> https://gitlab.com/freepascal.org/fpc/source/-/issues/39459 > You wrote > >> No, this can not and this will never work. When a generic parameter has > a constraint that constraint *must* be adhered to and a forward > declaration is *not* a valid type for such a constraint (except for > *class* / TObject constraints). > > Using TObject for just any class is nice here. > > What to use for interface? > https://gitlab.com/freepascal.org/fpc/source/-/issues/39459#note_758496897 > > Sorry replied on the wrong issue. > > > How can I restrain a generic param, so it must be an interface, but leave > open the exact type, so I can later use a forward declaration? > For interfaces you can use IInterface/IUnknown though that will work only for COM interfaces. For raw interfaces there is no solution currently. In my opinion you should rethink your code structure however. I don't know right now what would be better, but as it is now it feels bad. Regards, Sven >
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel