On 01/02/2026 16:50, Martin Frb via fpc-devel wrote:

Ok, lets see what other think / it wont help for now either, since it wont work with the current compiler.


But I do think that (other than the work for the compiler devs) it would be a neat feature.

And as I said it comes in useful if you have a generic...

I wanted

interface BaseList
  function IntfBaseItem

interface FooList(BaseList)
  function IntfFooItem  (inherits BaseItem)


generic ListFeature<_LIST: BaseList, _ITEM: BaseItem> = class
  procedure DoSomething(AnItem: _Item); virtual;
  procedure DoWork....;
end;


DoWork would go over the list, and for the correct items call DoSomething.

DoSomeThing needs the correct class, so if I specialize this as base, my new class

type TBar = class(specialize ListFeature<FooList, FooItem>)
  procedure DoSomething(AnItem: FooItem); override;
end

can access all the stuff that FooItem has.
_______________________________________________
fpc-devel maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to