[fpc-pascal] Class/Record helpers on genericd?

Anthony Walter sysrpl at gmail.com
Mon Apr 25 22:43:58 CEST 2016


Sven,

Correct me if I'm wrong, but didn't you add support for class/record
helpers on generics? For example I'd like to be able to add methods to
dynamic arrays:

type
  TArray<T> = array of <T>;
  TCompare<T> = function(constref A, B: T): Integer;

  TArrayHelper<T> = record helper for TArray<T>
  private
    ...
  public
    procedure Sort(Compare: TCompare);
    function First: T;
    function Last: T;
    function Random: T;
    // and so on
  end;

As it is right now the compiler will not allow this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160425/f52bcfef/attachment.html>


More information about the fpc-pascal mailing list