[fpc-pascal] Feature announcement: Dynamic array extensions
Ryan Joseph
ryan at thealchemistguild.com
Sat Jun 2 09:52:42 CEST 2018
> On Jun 2, 2018, at 2:42 PM, Sven Barth via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> It wasn't me who implemented that part. I personally had planned to do it with a warning for existing overloads, but Florian beat me to it and implemented it this way. Though when asked by me he did say that we'll wait and see if people complain... So *maybe* we'll change this.
>
btw why can’t there be both? You can have multiple + operators for any given dynamic array type can’t you?
type
TArrayOfInteger = array of integer;
operator + (left: TArrayOfInteger; right: integer): TArrayOfInteger;
var
i: integer;
begin
for i := 0 to high(left) do
left[i] += 1;
end;
operator + (left: TArrayOfInteger; right: TArrayOfInteger): TArrayOfInteger;
begin
result := Concat(left, right);
end;
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list