Am 02.02.2011 15:40, schrieb Anthony Walter:
By the way, does Free Pascal generic support generic constraints yet?
Also, this format seems more natural to me:


They aren't implemented currently, but I hope they will at some time.

TCollection<T: TCollectionItem> = class
   property Count: Integer;
   property Items[Index: Integer]: T;
end;

TStatusPanels = class(TCollection<TStatusPanel>);

rather than ...

generic TCollection<T> = class // no constrain ability
   property Count: Integer;
   property Items[Index: Integer]: T;
end;

TStatusPanels = specialize TCollection<TStatusPanel>;

When using FPC 2.5.1 you can use the Delphi compatible syntax in mode Delphi (not supported in mode ObjFPC).

When constraints are implemented they should work in both modes.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to