[fpc-pascal] Feature announcement: Dynamic array extensions
Ryan Joseph
ryan at thealchemistguild.com
Sun Jun 3 05:05:12 CEST 2018
> On Jun 2, 2018, at 3:19 PM, denisgolovan <denisgolovan at yandex.ru> wrote:
>
> BTW, you first overload is not implemented properly. You need to clone "left" first and return it as a result.
That’s probably the functionality you want but as an aside why can’t + overload mutate the caller (left side) and not return anything?
I would expect there to an operator like below in addition to the usual that returns the left side and assigns to the left aside on return.
class operator + (var left: TIntArray; const right: T);
if you’re appending to an array for example:
a += 1;
why should the compiler return the array (a) and then copy it back to the caller in the same place? It’s a just a waste and if the caller is a record it could be costly.
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list