Ryan Joseph <r...@thealchemistguild.com> schrieb am So., 3. Juni 2018,
10:22:

>
>
> > On Jun 3, 2018, at 3:15 PM, Sven Barth via fpc-pascal <
> fpc-pascal@lists.freepascal.org> wrote:
> >
> > Because operator overloads are static methods not normal methods.
>
> I don’t understand. Why aren’t both those variants possible? They’re both
> static I believe. The first is mutating the left side value and the second
> is a clone (the most common operation for += )
>
> class operator + (var left: TIntArray; const right: T);
> class operator + (constref left: TIntArray; const value: T): TIntArray;
>

Let me make one thing perfectly clear: the C-operators (+=, -=, *=, /=) do
not exist as explicit operators in FPC. They are merely syntactic sugar for
the more expressive variants and converted to those as soon as possible.

Regards,
Sven

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

Reply via email to