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

Hairy Pixels genericptr at gmail.com
Mon May 2 04:12:39 CEST 2022



> On May 1, 2022, at 10:36 AM, Hairy Pixels <genericptr at gmail.com> wrote:
> 
> Not sure what the best solution is but here are the ones I can think of:
> 
> 1) allow the helpers to use “array/set of T” syntax.

Sorry for the noise, one last point on this. So it looks like type helpers are already so strictly typed that a type alias for a dynamic array is not compatible with the anonymous dynamic array type (see below). Can this restriction be lifted or is it intentional in the design? I would think that TIntArray is just an alias and thus should be functionally the same as “array of integer”.

type
  TIntArray = array of integer;
  TMyArrayHelper = type helper for TIntArray
    procedure DoThis;
  end;

  procedure TMyArrayHelper.DoThis;
  begin
    writeln(Length(self));
  end;

var
  a: array of integer;
begin
  a.DoThis; // Illegal qualifier:
end.

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list