I'd like to have a generic objcclass that would add some extra functionality for multiple base types.  I don't have a lot of experience with generics, but this compiles:
------
generic TMyControl<T: TWinControl> = class(T)
  private
    FField: string;
procedure Foo;
  end;
  TMyEdit = specialize TMyControl<TEdit>;
------

and this fails with the error 'Class or interface type expected, but got "NSView"':
------
  generic NSMyView<T: NSView> = objcclass(T)
  private
    FField: string;
    procedure Foo; message 'Foo:';
  end;
------

The documentation doesn't mention it, so I'm assuming it's just not implemented.  Is that something that could be supported?  Would it be difficult to do so?  Are there any existing Objective Pascal specific tricks I could use to avoid duplicating all of the fields/code?
Thanks!
Zoë Peterson
Scooter Software
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to