> On Jun 2, 2018, at 3:19 PM, denisgolovan <denisgolo...@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

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

Reply via email to