[fpc-pascal] Overloading the increment operator (+=)
flavio.etrusco at gmail.com
Sun Sep 11 20:43:12 CEST 2011
On Sun, Sep 11, 2011 at 9:22 AM, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
> On 10 Sep 2011, at 22:32, Flávio Etrusco wrote:
>> Does FPC allow overloading the += operator? If not, why?
> It is translated into "x:=x+y" at the parser level, and overload resolving happens later. So once you overload "+" (and := if required), "+=" should also work.
Yes, I realize this. I'm revisiting the "StringBuilder" issue, and
"+=" can't be efficiently implemented with two operations (since
concatenating the operand would be unexpected to the user...).
More information about the fpc-pascal