On Fri, Jun 7, 2019 at 3:44 PM Sven Barth via fpc-devel <
fpc-devel@lists.freepascal.org> wrote:

> "0..5" defines a new type. "set of (Alpha, Beta, Gamma)" defines a new
> type. "record a, b: longint end" defines a new types.
>

Building on my last reply, also, here's an example that shows what I see as
the actual hypothetical ramifications of those in method signatures:

program Example;

{$mode ObjFPC}

type Letter = (A, B, C);

{ this *could* be valid code, because something like "TakesASet([A, C])" is
valid code }
procedure TakesASet(ASet: set of Letter);
begin
end;

{ this *could not* be valid code, because D, E and F do not exist outside
to actually call it with }
procedure ImpossibleTakesASet(ASet: set of (D, E, F));
begin
end;

{ this *could* be valid code, because something like "TakesARange(2)" is
valid code }
procedure TakesARange(ARange: 0..3);
begin
end;

{ this would be nonsensical IMO, because you could only call it with a
  variable of an existing named record type with identical fields, making
it pointless }
procedure TakesARecord(ARecord: record A, B: LongInt; end;);
begin
end;

begin
end.
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to