[fpc-pascal] Feature announcement: implicit generic function specializations

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Apr 30 14:02:55 CEST 2022


On Sat, 30 Apr 2022 18:17:25 +0700
Hairy Pixels via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:

>[...]
> So I wonder if the shorthand:
> 
> 	generic THelper<T> = class helper for TMyClass

AFAIK it is planned for mode objfpc to support distinguishing types via
template count as in mode delphi:

type
  TMyClass = class
  end;
  generic TMyClass<T> = class
  end;
  generic TMyClass<S,T> = class
  end;

So you would need something similar for helpers:

  THelper = class helper for TMyClass
  end;
  generic THelper<T> = class helper for specialize TMyClass<T> 
  end;
  generic THelper<S,T> = class helper for specialize TMyClass<S,T> 
  end;


Mattias


More information about the fpc-pascal mailing list